Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example images always inferred when running detect.py - how can I stop this? #13457

Open
1 of 2 tasks
essair opened this issue Dec 12, 2024 · 1 comment
Open
1 of 2 tasks
Labels
bug Something isn't working detect Object Detection issues, PR's

Comments

@essair
Copy link

essair commented Dec 12, 2024

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Detection

Bug

This is the output I get when running detect.py - each single time it runs the example images with the default model and then infers on my images with my model!

detect: weights=../../yolov5/yolov5s.pt, source=../../yolov5/data/images, data=../../yolov5/data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_format=0, save_csv=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=../../yolov5/runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 🚀 v7.0-389-ge62a31b6 Python-3.8.10 torch-2.4.1+cu121 CPU

Fusing layers...
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients, 16.4 GFLOPs
image 1/2 /home/name/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 37.6ms
image 2/2 /home/name/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, 32.2ms
Speed: 0.2ms pre-process, 34.9ms inference, 0.9ms NMS per image at shape (1, 3, 640, 640)
Results saved to ../../yolov5/runs/detect/exp418
YOLOv5 🚀 v7.0-389-ge62a31b6 Python-3.8.10 torch-2.4.1+cu121 CPU

Fusing layers...
Model summary: 157 layers, 7012822 parameters, 0 gradients, 15.8 GFLOPs
image 1/2 /dev/shm/2024-12-09/0299/3f2a3b04-70d0-4c88-a17d-9dec8fbfe9fb_00000000f6acf5d2_Z2EnnHkxxRg_day_2024-12-09T120039.jpg: 384x640 (no detections), 34.0ms
image 2/2 /dev/shm/2024-12-09/0299/9425430e-21f5-435c-a613-1dc4d0d60585_00000000f6acf5d2_G1yv3N-8gWM_night_2024-12-09T000035.jpg: 384x640 (no detections), 30.6ms

Environment

YOLOv5 🚀 v7.0-389-ge62a31b6 Python-3.8.10 torch-2.4.1+cu121 CPU
OS: Pop OS 20.04

Minimal Reproducible Example

I'm running detect.py as part of a pipeline processing many images. The pipeline is in R, here is where I call detect.py:

reticulate::use_virtualenv(virtualenv = file.path(user_path, "yolov5/venv"), required=TRUE)

reticulate::source_python(file.path(user_path, "yolov5/detect.py"))
run(source = image_folder, weights = model,
save_csv = TRUE, save_conf = TRUE, save_crop = TRUE, save_txt = TRUE,
exist_ok = FALSE, name= results_temp_folder, nosave = nosave_settings)

Every single time I run this line for each batch of images - thats several thousand times! - it first runs the detection on the example images, saving the results to the nth run in the yolov5 folder and then it runs on my images. Its costing me time and space on my computer! And I would be very grateful if someone can help me to prevent it from running!

Additional

I've tried running my script on another computer with a more up to date OS: Ubuntu 24 and Python 3.12 the exact same things happens!

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@essair essair added the bug Something isn't working label Dec 12, 2024
@pderrenger pderrenger added the detect Object Detection issues, PR's label Dec 12, 2024
@pderrenger
Copy link
Member

👋 Hello @essair, thank you for your interest in YOLOv5 🚀! Please make sure you have reviewed the YOLOv5 documentation and guides to help troubleshoot. They include helpful resources for topics ranging from custom data training to model debugging.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. This will help us investigate the issue effectively.

If this is a custom training ❓ Question, please include as much information as possible, such as your dataset structure, image examples, and any training logs. Make sure you are following the best practices for achieving optimal training results.

Requirements

Ensure you are using Python>=3.8.0 with all dependencies installed, including PyTorch>=1.8. You can set up YOLOv5 locally by cloning the repository, navigating to the folder, and installing the required dependencies.

Environments

YOLOv5 can run in various verified environments, including cloud notebooks with free GPUs, Google Cloud Deep Learning VMs, AWS Deep Learning AMIs, and Docker images with all dependencies preinstalled. Make sure your selected environment is up to date.

Status

Verify the status of YOLOv5 GitHub Actions Continuous Integration (CI) tests for the latest functionality. These tests verify proper model operation across various tasks such as training, validation, inference, and export.

This is an automated response to ensure you get help as quickly as possible. An Ultralytics engineer will respond soon to provide additional assistance. Thank you for your patience! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working detect Object Detection issues, PR's
Projects
None yet
Development

No branches or pull requests

2 participants