diff --git a/common/README.md b/common/README.md index 5c1153e7b4b709bc41cc8c1f6641df7cc1e923a0..a4fbdcaf17019aa71d1731abf0bf7c8221e2579e 100644 --- a/common/README.md +++ b/common/README.md @@ -44,7 +44,20 @@ It will enable the relative imports. #### ROCO -Telechargez le dossier [PolySTAR/RoboMaster/EÌquipe-Computer vision/DJI ROCO](https://drive.google.com/drive/folders/1AM3PqwwHzlK3tAS-1R5Qk3edPv0T4NzB) du drive, contenant tous les datasets fournis par DJI, et unzippez le dans le dossier [dataset/dji_roco](../dataset/dji_roco). +Download the directory [PolySTAR/RoboMaster/EÌquipe-Computer vision/DJI ROCO](https://drive.google.com/drive/folders/1AM3PqwwHzlK3tAS-1R5Qk3edPv0T4NzB) in Drive, with the 4 datasets given by DJI, and unzip in folder [dataset/dji_roco](../dataset/dji_roco). + +The dji_roco directory should look like: + + + +#### TWITCH + +Download the directory [PolySTAR/RoboMaster/EÌquipe-Computer vision/datasets/twitch/v1](https://drive.google.com/drive/folders/1TaxdzB57U9wII9K2VDOEP8vUMm94_cR7) in Drive, with the 8 labelized videos from twitch, and unzip in folder [dataset/twitch/v1](../dataset/twitch/v1). + +The twitch/v1 directory should look like: + + + ## Dataset creation diff --git a/common/doc/dataset_dji_repo.png b/common/doc/dataset_dji_repo.png new file mode 100644 index 0000000000000000000000000000000000000000..b34b590d26696a0652221e5abeed5833cbdf5d14 Binary files /dev/null and b/common/doc/dataset_dji_repo.png differ diff --git a/common/doc/dataset_twitch_repo.png b/common/doc/dataset_twitch_repo.png new file mode 100644 index 0000000000000000000000000000000000000000..5d1bd5958d432f370a722753716fb851119752bf Binary files /dev/null and b/common/doc/dataset_twitch_repo.png differ diff --git a/common/research_common/dataset/twitch/twitch_roco_datasets.py b/common/research_common/dataset/twitch/twitch_roco_datasets.py index a04bb75a3fac63e473d05d16463924f13a3f7f9e..368a7c48ee12d59cb1f91df26554f85e1f936a7d 100644 --- a/common/research_common/dataset/twitch/twitch_roco_datasets.py +++ b/common/research_common/dataset/twitch/twitch_roco_datasets.py @@ -1,15 +1,18 @@ from enum import Enum -from research_common.constants import TWITCH_DSET_ROBOTS_VIEWS_DIR +from research_common.constants import TWITCH_DSET_DIR from research_common.dataset.directory_roco_dataset import DirectoryROCODataset class TwitchROCODataset(DirectoryROCODataset, Enum): def __init__(self, competition_name: str): - super().__init__(TWITCH_DSET_ROBOTS_VIEWS_DIR / competition_name, self.name) + super().__init__(TWITCH_DSET_DIR / "v1" / competition_name, self.name) + TWITCH_470149568 = "470149568" TWITCH_470150052 = "470150052" TWITCH_470151286 = "470151286" + TWITCH_470152289 = "470152289" + TWITCH_470152730 = "470152730" TWITCH_470152838 = "470152838" TWITCH_470153081 = "470153081" - TWITCH_470152289 = "470152289" + TWITCH_470158483 = "470158483" diff --git a/common/research_common/scripts/construct_dataset_from_manual_annotation.py b/common/research_common/scripts/construct_dataset_from_manual_annotation.py index d3ab5188b70a695406761be7c49829f9e3741712..3178c9139ee0bba87e820e4859d74d3382e27306 100644 --- a/common/research_common/scripts/construct_dataset_from_manual_annotation.py +++ b/common/research_common/scripts/construct_dataset_from_manual_annotation.py @@ -3,8 +3,6 @@ from pathlib import Path from shutil import move, rmtree from zipfile import ZipFile -from research_common.constants import TWITCH_DSET_DIR, TWITCH_ROBOTS_VIEWS_DIR, TWITCH_DSET_ROBOTS_VIEWS_DIR - def construct_dataset_from_manual_annotations( source_images_directory: Path, source_annotations_directory: Path, destination_directory: Path @@ -29,9 +27,3 @@ def _unzip_all_in_directory(source_directory: Path, destination_directory: Path, for directory in destination_directory.glob("*"): if directory.is_dir(): rmtree(str(directory)) - - -if __name__ == "__main__": - construct_dataset_from_manual_annotations( - TWITCH_ROBOTS_VIEWS_DIR, TWITCH_DSET_DIR / "robots-views-annotations", TWITCH_DSET_ROBOTS_VIEWS_DIR, - ) diff --git a/common/research_common/scripts/construct_twith_datasets_from_manual_annotation.py b/common/research_common/scripts/construct_twith_datasets_from_manual_annotation.py index 44f643434662f809a7f7d73d0b0ce18d5acd3f97..3989bba47072f03992f2b9d29b6a059c95423082 100644 --- a/common/research_common/scripts/construct_twith_datasets_from_manual_annotation.py +++ b/common/research_common/scripts/construct_twith_datasets_from_manual_annotation.py @@ -1,4 +1,5 @@ -from shutil import copy, move, rmtree +from os import remove +from shutil import copy, move, rmtree, make_archive from research_common.constants import TWITCH_DSET_DIR, TWITCH_ROBOTS_VIEWS_DIR, TWITCH_DSET_ROBOTS_VIEWS_DIR from research_common.dataset.directory_roco_dataset import DirectoryROCODataset @@ -38,8 +39,9 @@ def _separate_twitch_videos(): move(str(annotation.xml_path), str(annotations_path / annotation.xml_path.name)) if list((TWITCH_DSET_ROBOTS_VIEWS_DIR / "image").glob("*")): raise Exception(f"Some images remains unmoved") - if list((TWITCH_DSET_ROBOTS_VIEWS_DIR / "image_annotation").glob("*")): - raise Exception(f"Some annotations remains unmoved") + for remaining_file in (TWITCH_DSET_ROBOTS_VIEWS_DIR / "image_annotation").glob("*"): + if remaining_file.name != ".DS_Store": + raise Exception(f"Some annotations remains unmoved") rmtree(str(TWITCH_DSET_ROBOTS_VIEWS_DIR / "image")) rmtree(str(TWITCH_DSET_ROBOTS_VIEWS_DIR / "image_annotation")) @@ -61,6 +63,12 @@ def _make_separate_reports(): if __name__ == "__main__": + + for zip_file in (TWITCH_DSET_DIR / "reviewed-robots-views-annotations").glob("*.zip"): + remove(str(zip_file)) + for chunk_dir in (TWITCH_DSET_DIR / "reviewed-robots-views-annotations").glob("chunk_*"): + make_archive(chunk_dir, "zip", chunk_dir) + _construct_mixed_twitch_dset() _correct_manual_annotations() _extract_runes_images() diff --git a/common/research_common/scripts/correct_annotations.py b/common/research_common/scripts/correct_annotations.py index 2dfb1a8608a46a43e29c50040701143da1df1ea2..5b45d96fcc2167c732484a7cc4dd8808ff2af4a1 100644 --- a/common/research_common/scripts/correct_annotations.py +++ b/common/research_common/scripts/correct_annotations.py @@ -3,14 +3,25 @@ from pathlib import Path class AnnotationFileCorrector: - FINAL_ARMOR_NAME_PATTERN = re.compile(r"<name>(armor|amor)-(?P<color>\w{2,4})-(?P<num>\d)</name>", re.IGNORECASE) - ABV_ARMOR_NAME_PATTERN = re.compile(r"<name>a(?P<color>\w)(?P<num>\d)</name>", re.IGNORECASE) + FINAL_ARMOR_NAME_PATTERN = re.compile( + r"<name>(armor|amor|amror)-(?P<color>\w{2,4})-(?P<num>\d)</name>", re.IGNORECASE + ) + ABV_ARMOR_NAME_PATTERN = re.compile(r"<name>a{1,2}(?P<color>\w)(?P<num>\d)</name>", re.IGNORECASE) ABV_RUNES_PATTERN = re.compile(r"<name>r(?P<color>\w)</name>", re.IGNORECASE) ABV_BASE_PATTERN = re.compile(r"<name>b</name>", re.IGNORECASE) ABV_WATCHER_PATTERN = re.compile(r"<name>w</name>", re.IGNORECASE) - ABV_CAR_PATTERN = re.compile(r"<name>[cx]</name>", re.IGNORECASE) - - COLORS_MAP = {"r": "red", "red": "red", "b": "blue", "blue": "blue", "g": "grey", "grey": "grey", "gray": "grey"} + ABV_CAR_PATTERN = re.compile(r"<name>(c|x|robot)</name>", re.IGNORECASE) + + COLORS_MAP = { + "r": "red", + "red": "red", + "b": "blue", + "bleu": "blue", + "blue": "blue", + "g": "grey", + "grey": "grey", + "gray": "grey", + } def __init__(self, save_before: bool): self.save_before = save_before diff --git a/dataset/twitch/.gitignore b/dataset/twitch/.gitignore index 6413c17d7139a7238fa5ef7c0878ab3ba8186f77..d1462f9c9f1d0a25d6d03aabeb9dd8b1b2b2391c 100644 --- a/dataset/twitch/.gitignore +++ b/dataset/twitch/.gitignore @@ -1,3 +1,4 @@ /robots-views-annotations /reviewed-robots-views-annotations -/final-robots-views \ No newline at end of file +/final-robots-views +/aerial-annotations \ No newline at end of file diff --git a/dataset/twitch/aerial-annotations/.gitignore b/dataset/twitch/v1/.gitignore similarity index 100% rename from dataset/twitch/aerial-annotations/.gitignore rename to dataset/twitch/v1/.gitignore