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

For online cutting training and detection can be improve #3942

Closed
Zigars opened this issue Jul 9, 2021 · 3 comments
Closed

For online cutting training and detection can be improve #3942

Zigars opened this issue Jul 9, 2021 · 3 comments
Labels
enhancement New feature or request Stale

Comments

@Zigars
Copy link
Contributor

Zigars commented Jul 9, 2021

🚀 Feature

For big image training, usually people thinking about to cut the images, but yolov5 can only resize the image to small size. Such as VisDrone dataset, the smallest image can have 960540 size, if resize to 640640, size would be 640*360, but the target in dataset mostly are small object, resize the image make the target become more smaller, but if use bigger resolution, the cuda memory would exceed.

So I thought online cutting training and detection would be a good feature for yolov5 to improve, although cutting image would also increase the train time, but it would be a great idea for people who don't have large computing power GPU, also I think cutting image would be effective for small object detection. Although it's not a new idea in detection, it would be a useful way for people to their own detector.

@Zigars Zigars added the enhancement New feature or request label Jul 9, 2021
@glenn-jocher
Copy link
Member

glenn-jocher commented Jul 12, 2021

@Zigars you can use the new Albumentations integration with RandomCrop to train on full resolution crops, i.e.:

python train.py --img 960
# with
A.RandomCrop(height=640, width=640, p=1.0)

self.transform = A.Compose([
A.Blur(p=0.1),
A.MedianBlur(p=0.1),
A.ToGray(p=0.01)],
bbox_params=A.BboxParams(format='yolo', label_fields=['class_labels']))

@github-actions
Copy link
Contributor

github-actions bot commented Aug 12, 2021

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

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 YOLOv5 🚀 and Vision AI ⭐!

@Camilochiang
Copy link

Camilochiang commented Dec 10, 2021

My apologies if I misunderstood and please correct me if I'm wrong.

  1. With this alternative you are actually training on the cropped resolution, no? So even if your pass the parameter, i.e 960, you will actually train YOLOv5 at 640 px (for your example, as the mosaic dataloader will merge 4 pics of 960 px, then crop the middle and then apply the albumentation on the image as mention here). This of course may help with the memory issue and finding small objects. Additionally one could later use a slicer along the pictures to the cropped resolution ( 640 px in our example) to get the best inference results ( I would love to try but I'm running another experiment for the last couple of days. This will be my next exercise)
  2. Then of course you are not fully using your data, as only one part of the image will be used. This should not be a problem in a dataset big enought, but still, will you recommend increasing the epochs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale
Projects
None yet
Development

No branches or pull requests

3 participants