ultralytics / ultralytics

NEW - YOLOv8 🚀 in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
28.07k stars 5.58k forks source link

Problem on detection of static objects #13536

Open Joeyabuki99 opened 2 months ago

Joeyabuki99 commented 2 months ago

Search before asking

Question

Hi guys! I'm doing a system where I use YOLOv8 only for the detection phase, and then on the areas detected I would apply a classifier. I've trained the YOLO model with the simple line:

results_m = model.train(data= myData, single_cls=False, imgsz=640, epochs = 25)

and this seems to give me good performance. The problem I have noticed is that, after training the classifier as well, when I try the system on a video, it seems that the detection only works if the objects of interest are moving, but when they stop, the detection also stops. Why does this happen?

Additional

No response

ixez commented 2 months ago

It shouldn't work like that. Please share your model and samples.

Joeyabuki99 commented 2 months ago

Hi!! I have this repo https://github.com/Joeyabuki99/video_detection.git with all the files. The only problem is that I cannot share with you the dataset for size problems. I can paste here some screenshot of the images if you want just to letting you know how it is done. As I say in the repo, I recorded and annotaated a lot of videos. From these, the frames with bounding boxes and their annotations have been used for the detection task, while for the classification I extracted all the bounding boxes, resized them and used them for the classifier. If you need the whole dataset, let me know how can I give it to you. Thanks!!

ixez commented 2 months ago

Can't run your code, it's too much irrelevant stuff and I don't know where to start. You'd better remove the classifier and other non-essential components to see if YOLO is the problem.

glenn-jocher commented 2 months ago

Hi @ixez,

Thank you for sharing your repository. To help you more effectively, let's focus on isolating the issue with YOLOv8. Here are a few steps you can take:

  1. Simplify the Code: Try to create a minimal reproducible example that only includes the YOLOv8 detection part. This will help us determine if the issue is with YOLOv8 or with the integration of the classifier. You can refer to our minimum reproducible example guide for more details.

  2. Update Packages: Ensure you are using the latest versions of torch and ultralytics. Sometimes, bugs are fixed in newer releases, and updating might resolve the issue.

  3. Check Static Object Detection: Run YOLOv8 on a video with static objects without the classifier. You can use the following code snippet to test this:

    from ultralytics import YOLO
    
    # Load your trained YOLOv8 model
    model = YOLO('path/to/your/yolov8_model.pt')
    
    # Run inference on a video
    results = model.predict(source='path/to/your/video.mp4', show=True)
    
    # Display results
    for result in results:
        result.show()
  4. Share Screenshots: If possible, share some screenshots of the frames where the detection fails when objects are static. This can provide more context and help us understand the issue better.

By following these steps, we can better isolate the problem and determine if it's related to YOLOv8 or the integration with your classifier. If the issue persists, please share the simplified code and any relevant details, and we'll be happy to assist further.

Joeyabuki99 commented 2 months ago

Hi @glenn-jocher these are some screen from the output. image image image image

glenn-jocher commented 2 months ago

Hi @Joeyabuki99,

Thank you for sharing the screenshots! They provide valuable context. To help us further investigate the issue, could you please provide a minimum reproducible example of your code? This will allow us to reproduce the problem on our end and identify a solution more effectively. You can find guidelines for creating a minimum reproducible example here.

Additionally, please ensure you are using the latest versions of torch and ultralytics. Sometimes, updating to the most recent versions can resolve unexpected issues. You can update your packages using the following commands:

pip install --upgrade torch ultralytics

Once you have a simplified version of your code that isolates the YOLOv8 detection part, please share it with us. This will help us pinpoint whether the issue lies with YOLOv8 or the integration with your classifier.

Looking forward to your response! 😊

Joeyabuki99 commented 2 months ago

Can't run your code, it's too much irrelevant stuff and I don't know where to start. You'd better remove the classifier and other non-essential components to see if YOLO is the problem.

@ixez I uploaded the repository so that u can have the code already done for tests:

glenn-jocher commented 2 months ago

Hi @Joeyabuki99,

Thank you for sharing your repository! To help us investigate the issue effectively, could you please provide a minimum reproducible example that isolates the YOLOv8 detection part? This will allow us to reproduce the problem on our end. You can find guidelines for creating a minimum reproducible example here.

Additionally, please ensure you are using the latest versions of torch and ultralytics. You can update your packages using the following commands:

pip install --upgrade torch ultralytics

Once you have a simplified version of your code, please share it with us. This will help us pinpoint whether the issue lies with YOLOv8 or the integration with your classifier.

Looking forward to your response! 😊

ixez commented 2 months ago

Can't open the video, it's only 2KB

glenn-jocher commented 2 months ago

Hi @ixez,

Thank you for your patience and for providing the repository. It seems like the video file might be corrupted or incomplete, as it's only 2KB in size. Could you please re-upload the video or provide a different sample that we can use to reproduce the issue?

In the meantime, please ensure you are using the latest versions of torch and ultralytics:

pip install --upgrade torch ultralytics

Additionally, if you could provide a minimum reproducible example that isolates the YOLOv8 detection part, it would greatly help us in diagnosing the issue. You can find guidelines for creating a minimum reproducible example here.

Looking forward to your response! 😊

github-actions[bot] commented 3 weeks ago

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐