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