-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Crop and save bounding box. I found yolov4 can do and any for yolov5? #2608
Comments
👋 Hello @mmez-11, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
follow this comment, it works really well |
Thanks. I checked what you mentioned. Actually i want the bbox's area only as an image. |
Here is the updated detect.py files which saves the bounding box as a separate image in 'test_images/results/'
|
OMG, that is worked. Thanks a lot. |
@mmez-11 Welcome. |
I have made a PR for these changes. I added the option to save the detected objects in a separate folder which will be in project/name/cropped when using detect.py. You can simply save this code as detect.py and use the option save_obj if you want to save the detected object. Thanks to @shivprasad94 for the initial codes but it only saves one object per image. I made the changes to save each detected object of an image.
|
@Ab-Abdurrahman hey, you're correct. I made written the function only to save only 1 cropped box. Just tested your scripts, works well for multiple boxes now. |
@Ab-Abdurrahman @shivprasad94 @mmez-11 Prediction box cropping is now available in YOLOv5 via PR #2827! PyTorch Hub models can use
|
hey @glenn-jocher --save-crop saves very few cropped images from a video; only two for each class. How do I increase this number? |
@pragyan430 --save-crop saves every detection. If you don't like your detections that's a separate issue that has nothing to do with cropping. |
hey @glenn-jocher ! I'm calling my detect.py code like this: !python detect.py --save-crop --source "/content/gdrive/MyDrive/cap_project/Rejected" --weights /content/gdrive/MyDrive/cap_project/capbest.pt ERROR: |
@Razamalik4497 your code is out of date. To update:
|
my code is working without writing "--save-crop" I just wrote: |
@glenn-jocher Regarding the "save-crop" parameter, where is the code for naming each picture for the cropped pictures? |
@jayer95 you might want to try searching detect.py for 'crop' |
@glenn-jocher Thank you for your help, I have found it. |
@glenn-jocher hi! I want to save the whole pic with a mark cropped on it , when the label of the video was detected, not only cropped image by saved ,what can i do thx |
--save-crop works on videos and streams also |
Can I fit save-crop save a picture every 5 seconds ? |
❔Question
Additional context
The text was updated successfully, but these errors were encountered: