-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Added CoarseDropout Augmentation #14
Conversation
* 'master' of https://github.com/datature/discolight: Add ColorTemperature augmentation (datature#2)
…coarsedropout-augmentation * 'master' of https://github.com/datature/discolight: added missing doc-annotations.csv Better README File Demonstrating Augmentations and Updated Snapshot Tests (datature#6) fixed issue with enum type parameters (datature#9)
…coarsedropout-augmentation * 'master' of https://github.com/datature/discolight: Revert "Added CoarseDropout Augmentation (datature#8)" (datature#12) Added CoarseDropout Augmentation (datature#8) Random Crop (datature#11)
@@ -0,0 +1,42 @@ | |||
image_name,x_min,y_min,x_max,y_max,label |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 \ |
There was a problem hiding this comment.
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 <= ( |
There was a problem hiding this comment.
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.
No description provided.