Commit 1a312c5f authored by Maxime Hubert's avatar Maxime Hubert
Browse files

Remove system outputs and partitions information from the abstract CLI

parent b0b73b7e
Pipeline #139001 passed with stage
in 1 minute and 5 seconds
output.json
_activity.json
_chunk.json
_file.json
_output.json
\ No newline at end of file
......@@ -112,15 +112,21 @@ def dataset_name_from_dirname(dirname, dataset_names):
return dataset_name
return None
def is_valid_container_output_dirname(dirname, dataset_names, strict):
def get_dataset_name_matching_dirname(dirname, dataset_names, strict):
"""Get the dataset name and check its format, and whether it exists
"""
if not dirname:
handle_error('system output format should be in the following format:<dataset-name>*', strict)
handle_error('system output format should be in the following format:<dataset-name>_*', strict)
if not any([dirname.startswith(dataset_name) for dataset_name in dataset_names]):
matching_dataset_names = [dataset_name for dataset_name in dataset_names if dirname.startswith(dataset_name + '_')]
if not matching_dataset_names:
return False
return True
# Return the longest dataset name matched, in case some names are composed of others
matching_dataset_names.sort(key=len, reverse=True)
return matching_dataset_names[0]
def validate_container_output(strict):
""" Check that container output directory is present.
......@@ -134,6 +140,10 @@ def validate_container_output(strict):
# Gather all system outputs paths
system_outputs_paths = [ dirname for dirname in os.listdir(container_output_dir) if os.path.isdir(os.path.join(container_output_dir, dirname)) ]
# Get the datasets names
baseline_results_path = os.path.join(os.path.dirname(__file__), 'baseline_outputs')
dataset_names = [ path for path in os.listdir(baseline_results_path) if os.path.isdir(os.path.join(baseline_results_path, path)) and path ]
# Check whether the container-outputs dir is empty
if not system_outputs_paths:
handle_error('no system output in {}'.format(container_output_dir), strict)
......@@ -143,19 +153,18 @@ def validate_container_output(strict):
system_output_name = os.path.basename(system_output_dir_path)
logging.info('Checking system output {}'.format(system_output_dir_path))
# 1st check: check if an output.json is present (right now only one file is required)
expected_files = import_expected_result('expected_container_output.txt')
for expected_file in expected_files:
dataset_filename = '*' + expected_file
files = os.path.join(container_output_dir, system_output_name, dataset_filename)
if not glob.glob(files):
handle_error("{} not present in {}".format(files, system_output_name), strict)
# 1st check: check that the system output name matches one of the partitions
dataset_name = get_dataset_name_matching_dirname(system_output_name, dataset_names, strict)
if dataset_name:
# 2nd check: check that the system output name matches one of the partitions
baseline_results_path = os.path.join(os.path.dirname(__file__), 'baseline_outputs')
dataset_names = [ path for path in os.listdir(baseline_results_path) if os.path.isdir(os.path.join(baseline_results_path, path)) and path ]
# 2nd check: check that all expected files are present
expected_files = import_expected_result('expected_container_output.txt')
for expected_file in expected_files:
dataset_filename = dataset_name + expected_file
dataset_filepath = os.path.join(container_output_dir, system_output_name, dataset_filename)
if not os.path.exists(dataset_filepath):
handle_error("Cannot find file {}".format(dataset_filepath), strict)
if is_valid_container_output_dirname(system_output_name, dataset_names, strict):
# 3rd check: check whether the output is identical to the baseline output
dataset_name = dataset_name_from_dirname(system_output_name, dataset_names)
......@@ -167,5 +176,5 @@ def validate_container_output(strict):
handle_error('container output file {} is identical to the baseline output on the same dataset.'.format(system_output_name, dataset_names), strict)
else:
handle_error('dataset name couldnt be extracted from "{}", it has to be one of {}'.format(system_output_name, dataset_names), strict)
handle_error('bad directory name "{}", it has to be <dataset_name>_* with dataset_name one of {}'.format(system_output_name, dataset_names), strict)
......@@ -4,13 +4,16 @@ Please use this folder to report your personal system outputs.
Create a subdirectory using the following pattern for its name:
```
<dataset-id>*/
<dataset-id>_*/
```
This subdirectory may then contain your system output using the following structure:
```
<dataset-id>*/
*output.json
<dataset-id>_*/
<dataset-id>_activity.json Activity index you used in this dataset
<dataset-id>_file.json File index you used in this dataset
<dataset-id>_chunk.json Output of the command design-chunks you ran on this dataset
<dataset-id>_output.json Output of the command merge-chunks you ran on this dataset
```
{
"Closing": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Closing_Trunk": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Entering": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Exiting": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Loading": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Open_Trunk": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Opening": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Pull": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Riding": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Talking": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Transport_HeavyCarry": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Unloading": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"activity_carrying": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"specialized_talking_phone": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"specialized_texting_phone": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_turning_left": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_turning_right": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_u_turn": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
}
}
\ No newline at end of file
{
"VIRAT_S_000206_02_000294_000327.mp4": {
"framerate": 30.0,
"selected": {
"1": 1,
"985": 0
}
},
"VIRAT_S_040003_02_000197_000552.mp4": {
"framerate": 30.0,
"selected": {
"1": 1,
"10638": 0
}
},
"VIRAT_S_040100_03_000496_000559.mp4": {
"framerate": 30.0,
"selected": {
"1": 1,
"1884": 0
}
},
"2018-03-14.07-30-04.07-35-04.G336.avi": {
"framerate": 30.0,
"selected": {
"1": 1,
"9000": 0
}
}
}
{
"Closing": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Closing_Trunk": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Entering": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Exiting": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Loading": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Open_Trunk": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Opening": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Pull": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Riding": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Talking": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Transport_HeavyCarry": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"Unloading": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"activity_carrying": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"specialized_talking_phone": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"specialized_texting_phone": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_turning_left": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_turning_right": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
},
"vehicle_u_turn": {
"objectTypeMap": {
"Construction_Vehicle": "*Vehicle*",
"Vehicle": "*Vehicle*"
},
"objectTypes": [
"Construction_Vehicle",
"Person",
"Vehicle"
]
}
}
\ No newline at end of file
{
"VIRAT_S_000206_02_000294_000327.mp4": {
"framerate": 30,
"selected": {
"1": 1,
"985": 0
}
},
"VIRAT_S_040003_02_000197_000552.mp4": {
"framerate": 30,
"selected": {
"1": 1,
"10638": 0
}
},
"VIRAT_S_040100_03_000496_000559.mp4": {
"framerate": 30,
"selected": {
"1": 1,
"1884": 0
}
},
"2018-03-14.07-30-04.07-35-04.school.G336.avi": {
"framerate": 30,
"selected": {
"1": 1,
"9000": 0
}
},
"2018-03-15.15-55-01.16-00-01.admin.G326.avi": {
"framerate": 30,
"selected": {
"1": 1,
"9001": 0
}