scripts/convert_to_upload_format.py
def convert_file_structure_to_upload_format(src_root_dir: pathlib.Path,
                                            dst_root_dir: pathlib.Path) -> None:
    """
    Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in
    a destination directory.

    :param src_root_dir: Source root directory to read files from.
    :param dst_root_dir: Destination root directory to store new file structure.
    """

    frame_dirs = [content for content in src_root_dir.iterdir() if content.is_dir()]

    logging.info("Creating new file structure")
    for frame_dir in tqdm.tqdm(frame_dirs):
        target_dirs = [content for content in frame_dir.iterdir() if content.is_dir()]
        for target_dir in target_dirs:
            target_name = target_dir.stem
            dst_target_dir = dst_root_dir / target_name

            dst_target_dir.mkdir(exist_ok=True, parents=True)

            for frame_filepath in target_dir.glob("*.jpeg"):
                shutil.copy(str(frame_filepath), str(dst_target_dir / frame_filepath.name))

    Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in
    a destination directory.

    :param src_root_dir: Source root directory to read files from.
    :param dst_root_dir: Destination root directory to store new file structure.
    
Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in
a destination directory.
Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in a destination directory .
def convert_file_structure_to_upload_format(src_root_dir: pathlib.Path,
                                            dst_root_dir: pathlib.Path) -> None:
    frame_dirs = [content for content in src_root_dir.iterdir() if content.is_dir()]
    logging.info("Creating new file structure")
    for frame_dir in tqdm.tqdm(frame_dirs):
        target_dirs = [content for content in frame_dir.iterdir() if content.is_dir()]
        for target_dir in target_dirs:
            target_name = target_dir.stem
            dst_target_dir = dst_root_dir / target_name
            dst_target_dir.mkdir(exist_ok=True, parents=True)
            for frame_filepath in target_dir.glob("*.jpeg"):
                shutil.copy(str(frame_filepath), str(dst_target_dir / frame_filepath.name))
def convert_file_structure_to_upload_format ( src_root_dir : pathlib . Path , dst_root_dir : pathlib . Path ) -> None : frame_dirs = [ content for content in src_root_dir . iterdir ( ) if content . is_dir ( ) ] logging . info ( "Creating new file structure" ) for frame_dir in tqdm . tqdm ( frame_dirs ) : target_dirs = [ content for content in frame_dir . iterdir ( ) if content . is_dir ( ) ] for target_dir in target_dirs : target_name = target_dir . stem dst_target_dir = dst_root_dir / target_name dst_target_dir . mkdir ( exist_ok = True , parents = True ) for frame_filepath in target_dir . glob ( "*.jpeg" ) : shutil . copy ( str ( frame_filepath ) , str ( dst_target_dir / frame_filepath . name ) )
Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in
a destination directory.
Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in a destination directory .
"""
    Copies contents of a source file structure and stores it as a format that is easier to upload to edge impulse in
    a destination directory.

    :param src_root_dir: Source root directory to read files from.
    :param dst_root_dir: Destination root directory to store new file structure.
    """
src_root_dir
pathlib.Path
Source root directory to read files from.
Source root directory to read files from .
dst_root_dir
pathlib.Path
Destination root directory to store new file structure.
Destination root directory to store new file structure .