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

Fix random bounding box crop #512

Merged
merged 12 commits into from Feb 6, 2019
Merged

Fix random bounding box crop #512

merged 12 commits into from Feb 6, 2019

Conversation

awolant
Copy link
Contributor

@awolant awolant commented Feb 5, 2019

No description provided.

Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
@awolant awolant requested review from mzient and a team February 5, 2019 11:44
@@ -129,20 +133,25 @@ void RandomBBoxCrop<CPUBackend>::RunImpl(SampleWorkspace *ws, const int) {
labels.emplace_back(*label_data);
}

const auto prospective_crop =
FindProspectiveCrop(bounding_boxes, labels, SelectMinimumOverlap());
while (true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use some reasonable value for max. number of attempts (100?) if allow_no_crop is not specified - otherwise this function may hang.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about changing this default value, as it severely degrades training accuracy. Additionally, with default threshold 0 and default allow_no_crop to true the problem should be somewhat alleviated. Maybe I add some info about this to op doc string? To be careful with these parameters and why.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while(true)? where is the break condition?

Copy link
Contributor Author

@awolant awolant Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a return statement, but the whole thing was rather clumsy. I added constructor for ProspectiveCrop and refactored it to make it more readable and easier to follow.

@awolant awolant requested a review from a team February 5, 2019 11:51
Signed-off-by: Albert Wolant <awolant@nvidia.com>
@awolant awolant requested a review from a team February 5, 2019 12:23
dali/pipeline/operators/crop/bbox_crop.h Show resolved Hide resolved
dali/pipeline/operators/crop/bbox_crop.h Outdated Show resolved Hide resolved
@@ -129,20 +133,25 @@ void RandomBBoxCrop<CPUBackend>::RunImpl(SampleWorkspace *ws, const int) {
labels.emplace_back(*label_data);
}

const auto prospective_crop =
FindProspectiveCrop(bounding_boxes, labels, SelectMinimumOverlap());
while (true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while(true)? where is the break condition?

dali/pipeline/operators/crop/bbox_crop.cc Outdated Show resolved Hide resolved
dali/pipeline/operators/crop/bbox_crop.h Outdated Show resolved Hide resolved
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
@awolant
Copy link
Contributor Author

awolant commented Feb 5, 2019

Builds 624482

Signed-off-by: Albert Wolant <awolant@nvidia.com>
@awolant
Copy link
Contributor Author

awolant commented Feb 6, 2019

Builds 625254

dali/pipeline/operators/crop/bbox_crop.cc Outdated Show resolved Hide resolved
dali/pipeline/operators/crop/bbox_crop.h Outdated Show resolved Hide resolved
dali/pipeline/operators/crop/bbox_crop.h Outdated Show resolved Hide resolved
Signed-off-by: Albert Wolant <awolant@nvidia.com>
@awolant
Copy link
Contributor Author

awolant commented Feb 6, 2019

Builds 625321

@awolant awolant merged commit 35f4919 into NVIDIA:master Feb 6, 2019
haoxintong pushed a commit to haoxintong/DALI that referenced this pull request Jul 16, 2019
* Fix RandomBBox crop

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Add sample options

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Fix lint errors

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Add ProspectiveCrop as struct

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Refactored FindProspectiveCrop calls

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Fixed indentations

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Add comment to explain sample_options_

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Improved docs

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Removed _ from fields names in ProspectiveCrop

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Refactor ProspectiveCrop defautl ctor

Signed-off-by: Albert Wolant <awolant@nvidia.com>

* Address review comments

Signed-off-by: Albert Wolant <awolant@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants