Adapters

To convert data from/to various formats


file_2_bytes

 file_2_bytes (fpath)

bytes_2_file

 bytes_2_file (input:bytes, fpath:Union[str,pathlib.Path],
               silent:bool=False)

Save bytes input at given fpath

Type Default Details
input bytes bytes
fpath Union Place where you want to save the file
silent bool False
Returns None

b64_2_file

 b64_2_file (input:str, fpath:Union[str,pathlib.Path])

Save a file encoded as a base64 input at given fpath

Type Details
input str base64 encoded string
fpath Union Place where you want to save the file
Returns None

b64_2_np

 b64_2_np (input:str)

*Converts a base64 encoded image to a NumPy array.

Args: input (str): The base64 encoded image.

Returns: np.ndarray: The NumPy array representation of the image in RGB format.*


np_2_b64

 np_2_b64 (image:numpy.ndarray)

Convert a numpy image to base64 string


cvat_2_csvs

 cvat_2_csvs (xmlfile, csvs_folder)

*Convert CVAT XML annotations to CSV files.

Args: xmlfile (str): Path to the CVAT XML file. csvs_folder (str): Path to the folder where the CSV files will be saved.

Returns: None*


csvs_2_cvat

 csvs_2_cvat (images_folder, csvs_folder, xml_output_file, items=None,
              parquet=False, relative_df=True, default_label='Background',
              extension='jpg')

*Convert CSV annotations to CVAT XML format.

Args: images_folder (str): Path to the folder containing the images. csvs_folder (str): Path to the folder containing the CSV annotations. xml_output_file (str): Path to the output XML file. items (list, optional): List of items to process. If None, all items will be processed. Defaults to None. parquet (bool, optional): Whether the annotations are stored in Parquet format. Defaults to False. relative_df (bool, optional): Whether the bounding box coordinates in the CSV are relative to the image size. Defaults to True. default_label (str, optional): Default label for the bounding boxes. Defaults to “Background”. extension (str, optional): Image file extension. Defaults to “jpg”.

Returns: None*


yolo_2_df

 yolo_2_df (yolo, h, w, id2class, class_column)

df_2_yolo

 df_2_yolo (df, h, w, class2id, class_column)