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

Where the changes should be made to detect horizontal line and vertical lines? Can anyone discus elaborately? #2070

Closed
Sagor-Saha opened this issue Jan 28, 2021 · 7 comments
Labels

Comments

@Sagor-Saha
Copy link

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2021

👋 Hello @Sagor-Saha, 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 [email protected].

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If 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.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 28, 2021

@Sagor-Saha for very thin objects you may need to relax the aspect ratio constraints on labels in the dataloader, which are set to <20 by default. Other than that no real changes are required, though if your entire dataset is composed of extreme aspect ratio objects a more advanced redistribution of the convolution kernels may help you (i.e. alternate some 3x3s to 1x9 and 9x1 etc).

yolov5/utils/datasets.py

Lines 907 to 913 in 630ec06

def box_candidates(box1, box2, wh_thr=2, ar_thr=20, area_thr=0.1, eps=1e-16): # box1(4,n), box2(4,n)
# Compute candidate boxes: box1 before augment, box2 after augment, wh_thr (pixels), aspect_ratio_thr, area_ratio
w1, h1 = box1[2] - box1[0], box1[3] - box1[1]
w2, h2 = box2[2] - box2[0], box2[3] - box2[1]
ar = np.maximum(w2 / (h2 + eps), h2 / (w2 + eps)) # aspect ratio
return (w2 > wh_thr) & (h2 > wh_thr) & (w2 * h2 / (w1 * h1 + eps) > area_thr) & (ar < ar_thr) # candidates

@Sagor-Saha
Copy link
Author

Sagor-Saha commented Jan 28, 2021

Thank you for responding. Considering the horizontal lines are say(width 5pixel height 500-700 pixel) and vertical line are say( opposite of horizontal), would it work ifI change the aspect ratio to 500?

@glenn-jocher
Copy link
Member

@Sagor-Saha have no idea what you mean by will it 'work', but the above function controls candidate label criteria. If you want your objects to pass and be included in training, then you should adjust the thresholds accordingly.

@Sagor-Saha
Copy link
Author

Yes. I mean to say if update the parameter you talked about. Will the model be able to detect horizontal and vertical line images?

@glenn-jocher
Copy link
Member

glenn-jocher commented Jan 28, 2021

Well, there's no way to know what sort of metrics your training might produce on your custom data unless you actually train.

If you modify the thresholds to allow these objects to pass, i.e. ar_thr=1000 will effectively allow all aspect ratio labels to pass, then they will at least be included in training.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants