hawk_eye.data_generation.create_detection_data¶
This script generates training data for the object detector model. The output will be images and the corresponding COCO metadata jsons. For most RetinaNet related training we can train on images with _and without_ targets. Training on images without any targets is valuable so the model sees that not every image will have a target, as this is the real life case.
-
hawk_eye.data_generation.create_detection_data.
add_shapes
(background: PIL.Image.Image, shape_imgs: PIL.Image.Image, shape_params, blur_radius: int) → Tuple[List[Tuple[int, int, int, int, int]], PIL.Image.Image][source]¶ Paste shapes onto background and return bboxes
-
class
hawk_eye.data_generation.create_detection_data.
alpha_params
(font_multiplier:Tuple[int, int])[source]¶
-
hawk_eye.data_generation.create_detection_data.
create_shape
(shape, base, alpha, font_file, size, angle, target_color, target_rgb, alpha_color, alpha_rgb, x, y) → PIL.Image.Image[source]¶ Create a shape given all the input parameters
-
hawk_eye.data_generation.create_detection_data.
generate_all_images
(gen_type: pathlib.Path, num_gen: int, offset: int = 0) → None[source]¶ Main function which prepares all the relevant information regardining data generation. Data will be generated using a multiprocessing pool for efficiency.
- Parameters
gen_type – The name of the data being generated.
num_gen – The number of images to generate.
offset – TODO(alex): Are we still using this?
-
hawk_eye.data_generation.create_detection_data.
generate_single_example
(data) → None[source]¶ Creates a single full image
-
hawk_eye.data_generation.create_detection_data.
get_backgrounds
() → List[pathlib.Path][source]¶ Get a list of all the background images.
-
hawk_eye.data_generation.create_detection_data.
get_base
(base, target_rgb, size)[source]¶ Copy and recolor the base shape
-
hawk_eye.data_generation.create_detection_data.
get_base_shapes
(shape)[source]¶ Get the base shape images for a given shapes