Load custom yolov5 model on streamlit. AttributeError: Can't get attribute 'SPPF' on <module 'models.common' #8014
Unanswered
anhhaokudo
asked this question in
Q&A
Replies: 1 comment
-
@anhhaokudo your YOLOv5 code is out of date. To update:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm very new to yolo so I have a lot of fundamental questions, but ultimately I want to deploy a Streamlit webapp using a custom model.
I have been trying to follow https://github.com/xugaoxiang/yolov5-streamlit to deploy a streamlit webapp. The goal is to replace the model by my custom model.
My teammate trained a model and sent this new best.pt file to me. I replaced the yolov5s.pt by the best.pt file in the detect.py script and got the error
**2022-05-28 08:23:49.339 YOLOv5 🚀 39fe0ee torch 1.7.1 CPU
2022-05-28 08:23:49.556 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 475, in _run_script
exec(code, module.dict)
File "/app/xx/main.py", line 95, in
detect(opt)
File "/app/xx/detect.py", line 37, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "/app/xx/models/experimental.py", line 118, in attempt_load
ckpt = torch.load(w, map_location=map_location) # load
File "/home/appuser/venv/lib/python3.9/site-packages/torch/serialization.py", line 594, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/home/appuser/venv/lib/python3.9/site-packages/torch/serialization.py", line 853, in _load
result = unpickler.load()
AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from xx**
I followed #5175 (comment) for troubleshooting but the error persists.
Thanks in advance if someone could guide me to the right direction.
Beta Was this translation helpful? Give feedback.
All reactions