7 #ifndef TURI_NEURAL_NET_IMAGE_AUGMENTATION_HPP_ 8 #define TURI_NEURAL_NET_IMAGE_AUGMENTATION_HPP_ 14 #include <ml/neural_net/Image.hpp> 15 #include <ml/neural_net/float_array.hpp> 18 namespace neural_net {
28 image_box(
float x,
float y,
float width,
float height)
29 : x(x), y(y), width(width), height(height)
32 bool empty()
const {
return width <= 0.f || height <= 0.f; }
36 return empty() ? 0.f : (width * height);
40 void normalize(
float image_width,
float image_height);
58 std::ostream& operator<<(std::ostream& out,
const image_box& box);
66 float confidence = 0.f;
75 std::shared_ptr<Image> image;
76 std::vector<image_annotation> annotations;
79 std::vector<image_annotation> predictions;
93 float min_aspect_ratio = 0.8f;
96 float max_aspect_ratio = 1.25f;
102 float min_area_fraction = 0.15f;
108 float max_area_fraction = 1.f;
115 float min_object_covered = 0.f;
121 size_t max_attempts = 50;
128 float min_eject_coverage = 0.5f;
135 float min_aspect_ratio = 0.8f;
138 float max_aspect_ratio = 1.25f;
144 float min_area_fraction = 1.f;
150 float max_area_fraction = 2.f;
156 size_t max_attempts = 50;
168 size_t batch_size = 0;
171 size_t output_width = 0;
174 size_t output_height = 0;
180 float crop_prob = 0.f;
184 float pad_prob = 0.f;
188 float horizontal_flip_prob = 0.f;
200 float brightness_max_jitter = 0.f;
208 float contrast_max_jitter = 0.f;
216 float saturation_max_jitter = 0.f;
224 float hue_max_jitter = 0.f;
244 virtual const options& get_options()
const = 0;
252 virtual result prepare_images(std::vector<labeled_image> source_batch) = 0;
268 result prepare_images(std::vector<labeled_image> source_batch)
override;
303 #endif // TURI_NEURAL_NET_IMAGE_AUGMENTATION_HPP_
std::vector< shared_float_array > annotations
std::vector< std::vector< image_annotation > > annotations_batch
shared_float_array image_batch
std::vector< shared_float_array > annotations
shared_float_array images
std::vector< shared_float_array > images
const options & get_options() const override