priya-zha / Software-Engineering-Project

0 stars 2 forks source link

Object detection failed because of wrong YOLO configurations. #19

Closed preddythandra closed 1 year ago

preddythandra commented 1 year ago

Detailed Description:

YOLO model from ultralytics not correctly configured with the supervision module, thus the detection's functions lead to error, thus rendering the application useless.

Steps to Reproduce:

Replace the sv.Detections.from_ultralytics function to sv.Detections.from_yolov8.

Expected Behavior:

The yolo model generates the boundary box and returns the new image with the boundary box data inscribed on the image to the client.

Actual Behavior:

The flask server raises a Attribute Error and stops working, thus not providing any data to the client application.

Before Fixing the bug[Server Log]: image

After Fixing the bug: image

preddythandra commented 1 year ago

Solution: Replaced the yolo with latest version and change to ultralytics module for generation of detections.

https://github.com/priya-zha/Software-Engineering-Project/blob/6bd2cdfebc623f576a2d2aee72c7acd769e83315/ML/main.py

            model = YOLO("yolov8s.pt")
            result = model(image, agnostic_nms=True)[0]
            detections = sv.Detections.from_ultralytics(result)