rampal-punia / yolov8-streamlit-detection-tracking

Object detection and tracking algorithm implemented for Real-Time video streams and static images.
https://codingmantras-yolov8-streamlit-detection-tracking-app-njcqjg.streamlit.app/
279 stars 119 forks source link

Object detection with custom YOLOv5 model #9

Closed nguyenduylinhqbu closed 9 months ago

nguyenduylinhqbu commented 9 months ago

Dear Sir @CodingMantras, I have modified several YOLOv5 models and want to apply them to your app. How and where can I change the code? I am looking forward to hearing from you soon. Thank you very much. Best regards.

rampal-punia commented 9 months ago

Hi, You just need to do two simple steps:

1: Place the model (Your custom model .pt file) inside the weights folder

2: Add the name of the weight pt file inside settings.py

# ML Model config
MODEL_DIR = ROOT / 'weights'
# DETECTION_MODEL = MODEL_DIR / 'yolov8n.pt' # Comment out this line and

# Place your custom model pt file name here
DETECTION_MODEL = MODEL_DIR / 'my_detection_model.pt'
nguyenduylinhqbu commented 9 months ago

Dear sir @CodingMantras, I followed your guide but I faced this error. Please let me know how to fix it. Thank you.


ERROR ❌️ weights/best_IWIS23.pt appears to be an Ultralytics YOLOv5 model originally trained with https://github.com/ultralytics/yolov5. This model is NOT forwards compatible with YOLOv8 at https://github.com/ultralytics/ultralytics. Recommend fixes are to train a new model using the latest 'ultralytics' package or to run a command with an official YOLOv8 model, i.e. 'yolo predict model=yolov8n.pt'

rampal-punia commented 9 months ago

This repo is created using the yolov8 code and it is obvious from the ERROR that, the yolov5 trained model will not work here. You can use a model trained with yolov8 train.py in this case.

nguyenduylinhqbu commented 9 months ago

Dear @CodingMantras, I got it. Thank you very much.