def test_filter_qrcodes_empty():
    qrcode_paths_empty = prepare_empty_qrs()
    with pytest.raises(Exception) as e:
        filter_blacklisted_persons(qrcode_paths_empty)
    assert str(e.value) == "The provided person_path is empty", e.value
def test_filter_qrcodes_wrong_size():
    qrcode_paths_wrong = prepare_wrong_qrs()
    with pytest.raises(AssertionError) as e:
        filter_blacklisted_persons(qrcode_paths_wrong)
    assert str(e.value) == "1585360775-fa64muouelXXXX", "first wrong qrcode"
Exemple #3
0
    dataset_name = CONFIG.DATASET_NAME

    # Mount or download
    dataset_path = run.input_datasets['cgm_dataset']

# Get the QR-code paths.
dataset_scans_path = os.path.join(dataset_path, "scans")
logger.info('Dataset path: %s', dataset_scans_path)
#logger.info(glob.glob(os.path.join(dataset_scans_path, "*"))) # Debug
logger.info('Getting QR-code paths...')
qrcode_paths = glob.glob(os.path.join(dataset_scans_path, "*"))
logger.info('qrcode_paths: %d', len(qrcode_paths))
assert len(qrcode_paths) != 0

qrcode_paths = filter_blacklisted_persons(qrcode_paths)

# Shuffle and split into train and validate.
random.seed(CONFIG.SPLIT_SEED)
random.shuffle(qrcode_paths)
split_index = int(len(qrcode_paths) * 0.8)
qrcode_paths_training = qrcode_paths[:split_index]
qrcode_paths_validate = qrcode_paths[split_index:]

del qrcode_paths

# Show split.
logger.info('Paths for training: \n\t' + '\n\t'.join(qrcode_paths_training))
logger.info('Paths for validation: \n\t' + '\n\t'.join(qrcode_paths_validate))

logger.info('Nbr of qrcode_paths for training: %d', len(qrcode_paths_training))
def test_filter_blacklisted_qrcodes():
    qrcode_paths = prepare_qrs()
    filtered_qrcode_paths = filter_blacklisted_persons(qrcode_paths)
    assert (len(filtered_qrcode_paths) == 3)
Exemple #5
0
    dataset_name = CONFIG.DATASET_NAME

    # Mount or download
    dataset_path = run.input_datasets['cgm_dataset']

# Get the QR-code paths.
dataset_path = os.path.join(dataset_path, "scans")
logger.info('Dataset path: %s', dataset_path)
#logger.info(glob.glob(os.path.join(dataset_path, "*"))) # Debug
logger.info('Getting QR-code paths...')
person_paths = glob.glob(os.path.join(dataset_path, "*"))
logger.info('person_paths: %d', len(person_paths))
assert len(person_paths) != 0

person_paths = filter_blacklisted_persons(person_paths)

# Shuffle and split into train and validate.
random.shuffle(person_paths)
split_index = int(len(person_paths) * 0.8)
person_paths_training = person_paths[:split_index]
person_paths_validate = person_paths[split_index:]

del person_paths

# Show split.
logger.info('Paths for training: \n\t' + '\n\t'.join(person_paths_training))
logger.info('Paths for validation: \n\t' + '\n\t'.join(person_paths_validate))

logger.info('Nbr of person_paths for training: %d', len(person_paths_training))
logger.info('Nbr of person_paths for validation: %d',