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

Added CoarseDropout Augmentation #14

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

tingalinga
Copy link
Contributor

No description provided.

@@ -0,0 +1,42 @@
image_name,x_min,y_min,x_max,y_max,label
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please untrack this file. It has been superseded by CoarseDropout-bboxes.npy.

@staticmethod
def params():
"""Return a Params object describing constructor parameters."""
return Params().add("deleted_area", "", float,
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should probably have type BoundedNumber, since you are enforcing some bounds in your augment_img function.

"""Augment an image."""
width, height = img.shape[1], img.shape[0]
self.deleted_area = self.deleted_area \
if self.deleted_area <= 1 and self.deleted_area >= 0 \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to randomly select deleted_area only if the initial value is 0, and have deleted_area take the type BoundedNumber(float, minimum=0).

Additionally, I think it's better to perform the entire initialization process in __init__ rather than in augment_img. The way you have written it self.deleted_area will only be randomly initialized at most once (because after a value is picked it will be between 0 and 1). This is a fine choice, but to make it more clear that this is your intent the initialization should be done in the constructor.

if self.deleted_area <= 1 and self.deleted_area >= 0 \
else random.uniform(
0, 1)
self.num_rectangles = self.num_rectangles \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments as for the deleted_area parameter. In addition, is there a reason for not wanting num_rectangles to be less than 10?

margin = 0.02
print(aug_p)

assert aug_p <= (
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to consider using the built-in function math.isclose instead: https://docs.python.org/dev/library/math.html#math.isclose.

@ian-datature ian-datature added this to the v0.2.0 milestone Aug 12, 2020
@ian-datature ian-datature removed this from the v0.2.0 milestone Sep 22, 2020
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.

2 participants