computer_vision.mosaic_augmentation =================================== .. py:module:: computer_vision.mosaic_augmentation .. autoapi-nested-parse:: Source: https://github.com/jason9075/opencv-mosaic-data-aug Attributes ---------- .. autoapisummary:: computer_vision.mosaic_augmentation.FILTER_TINY_SCALE computer_vision.mosaic_augmentation.IMG_DIR computer_vision.mosaic_augmentation.LABEL_DIR computer_vision.mosaic_augmentation.NUMBER_IMAGES computer_vision.mosaic_augmentation.OUTPUT_DIR computer_vision.mosaic_augmentation.OUTPUT_SIZE computer_vision.mosaic_augmentation.SCALE_RANGE Functions --------- .. autoapisummary:: computer_vision.mosaic_augmentation.get_dataset computer_vision.mosaic_augmentation.main computer_vision.mosaic_augmentation.random_chars computer_vision.mosaic_augmentation.update_image_and_anno Module Contents --------------- .. py:function:: get_dataset(label_dir: str, img_dir: str) -> tuple[list, list] - label_dir : Path to label include annotation of images - img_dir : Path to folder contain images Return : List of images path and labels .. py:function:: main() -> None Get images list and annotations list from input dir. Update new images and annotations. Save images and annotations in output dir. .. py:function:: random_chars(number_char: int) -> str Automatic generate random 32 characters. Get random string code: '7b7ad245cdff75241935e4dd860f3bad' >>> len(random_chars(32)) 32 .. py:function:: update_image_and_anno(all_img_list: list, all_annos: list, idxs: list[int], output_size: tuple[int, int], scale_range: tuple[float, float], filter_scale: float = 0.0) -> tuple[list, list, str] - all_img_list : list of all images - all_annos : list of all annotations of specific image - idxs : index of image in list - output_size : size of output image (Height, Width) - scale_range : range of scale image - filter_scale : the condition of downscale image and bounding box Return: - output_img : image after resize - new_anno : list of new annotation after scale - path[0] : get the name of image file .. py:data:: FILTER_TINY_SCALE :value: 0.01 .. py:data:: IMG_DIR :value: '' .. py:data:: LABEL_DIR :value: '' .. py:data:: NUMBER_IMAGES :value: 250 .. py:data:: OUTPUT_DIR :value: '' .. py:data:: OUTPUT_SIZE :value: (720, 1280) .. py:data:: SCALE_RANGE :value: (0.4, 0.6)