def main():
    print('***** Step 3/4: Generate Centroids *****')
    time1 = time.time()
    config_path = os.path.join(CARRADA_HOME, 'config.ini')
    config = Configurable(config_path).config
    warehouse = config['data']['warehouse']
    carrada = os.path.join(warehouse, 'Carrada')
    with open(os.path.join(carrada, 'data_seq_ref.json'), 'r') as fp:
        ref_data = json.load(fp)
    with open(os.path.join(carrada, 'validated_seqs.txt')) as fp:
        seq_names = fp.readlines()
    seq_names = [seq.replace('\n', '') for seq in seq_names]
    data_types = ['cluster']
    for seq_name in seq_names:
        print('*** Processing sequence {} ***'.format(seq_name))
        ref_ids = ref_data[seq_name]['ref_frame']
        instances = ref_data[seq_name]['instances']
        min_frame_boundaries = ref_data[seq_name]['min_frame_boundaries']
        max_frame_boundaries = ref_data[seq_name]['max_frame_boundaries']
        labels = ref_data[seq_name]['labels']
        for data_type in data_types:
            print('===> Generating {} annotations with Jensen-Shannon strategy'.format(data_type))
            CentroidTracking(seq_name, instances, ref_ids, labels, min_frame_boundaries,
                             max_frame_boundaries).create_annotations(save_annotations=True,
                                                                      save_vis_rd=False,
                                                                      save_vis_doa=False,
                                                                      data_type=data_type)
    print('***** Execution Time for Step 3/4:'
          ' {} secs. *****'.format(round(time.time() - time1, 2)))
Exemplo n.º 2
0
def main():
    print('***** Step 2/4: Generate Range-Doppler points *****')
    time1 = time.time()
    config_path = os.path.join(CARRADA_HOME, 'config.ini')
    config = Configurable(config_path).config
    warehouse = config['data']['warehouse']
    carrada = os.path.join(warehouse, 'Carrada')
    with open(os.path.join(carrada, 'data_seq_ref.json'), 'r') as fp:
        ref_data = json.load(fp)
    with open(os.path.join(carrada, 'validated_seqs.txt')) as fp:
        seq_names = fp.readlines()
    seq_names = [seq.replace('\n', '') for seq in seq_names]
    for seq_name in seq_names:
        print('*** Processing sequence {} ***'.format(seq_name))
        instances = ref_data[seq_name]['instances']
        n_points = 1
        time_window = 10
        generator = RDPointsGenerator(seq_name, n_points, instances,
                                      time_window)
        _, _ = generator.get_rd_points(save_rd_imgs=False,
                                       save_points=True,
                                       save_points_coordinates=False,
                                       save_world_points=True)
    print('***** Execution Time for Step 2/4:'
          ' {} secs. *****'.format(round(time.time() - time1, 2)))
def main():
    print('***** Step 4/4: Generate Annotation Files *****')
    time1 = time.time()
    config_path = os.path.join(CARRADA_HOME, 'config.ini')
    config = Configurable(config_path).config
    warehouse = config['data']['warehouse']
    carrada = os.path.join(warehouse, 'Carrada')
    with open(os.path.join(carrada, 'validated_seqs.txt')) as fp:
        sequences = fp.readlines()
    with open(os.path.join(carrada, 'instance_exceptions.json'), 'r') as fp:
        instance_exceptions = json.load(fp)
    sequences = [seq.replace('\n', '') for seq in sequences]
    annotations_io = get_instance_oriented(sequences, instance_exceptions,
                                           carrada)
    annotations_fo = get_frame_oriented(sequences, instance_exceptions,
                                        carrada)
    print('***** Execution Time for Step 4/4:'
          ' {} secs. *****'.format(round(time.time() - time1, 2)))
Exemplo n.º 4
0
def main():
    print('***** Step 1/4: Generate instances *****')
    time1 = time.time()
    config_path = os.path.join(CARRADA_HOME, 'config.ini')
    config = Configurable(config_path).config
    warehouse = config['data']['warehouse']
    carrada = os.path.join(warehouse, 'Carrada')
    with open(os.path.join(carrada, 'validated_seqs.txt')) as fp:
        sequence_names = fp.readlines()
    sequence_names = [seq.replace('\n', '') for seq in sequence_names]
    for seq_name in sequence_names:
        InstanceGenerator().process_sequence(seq_name,
                                             0,
                                             save_boxes=False,
                                             save_masks=False,
                                             save_labels=True,
                                             save_instances_masks=False)
    print('***** Execution Time for Step 1/4:'
          ' {} secs. *****'.format(round(time.time() - time1, 2)))
import os
import json
import glob
import pytest
import torchvision

from utils import CARRADA_HOME
from utils.configurable import Configurable
from utils.sort import Sort
from annotation_generators.instance_generator import InstanceGenerator, ImageInstances

SEQ_NAME = '2020-02-28-13-09-58'
CONFIG_PATH = os.path.join(CARRADA_HOME, 'config.ini')
CONFIG = Configurable(CONFIG_PATH).config
CARRADA = os.path.join(CONFIG['data']['warehouse'], 'Carrada')


def get_img_points():
    real_data = dict()
    with open(os.path.join(CARRADA, SEQ_NAME, 'points.json'), 'r') as fp:
        real_points = json.load(fp)
    sequence_path = os.path.join(CARRADA, SEQ_NAME)
    img_paths = sorted(
        glob.glob(os.path.join(sequence_path, 'camera_images', '*.jpg')))
    img_paths = sorted(
        glob.glob(os.path.join(sequence_path, 'camera_images', '*.jpg')))
    for img_path in img_paths[72:80]:
        img_name = img_path.split('/')[-1].split('.')[0]
        real_data[img_name] = real_points[SEQ_NAME][img_name]  # ['001114'][0]
    return real_data
Exemplo n.º 6
0
"""Script to set the path to CARRADA in the config.ini file"""
import os
import sys
from utils.configurable import Configurable
from utils import CARRADA_HOME

if __name__ == '__main__':
    path_to_carrada = sys.argv[1]
    configurable = Configurable(os.path.join(CARRADA_HOME, 'config.ini'))
    configurable.set('data', 'warehouse', path_to_carrada)
    with open(os.path.join(CARRADA_HOME, 'config.ini'), 'w') as fp:
        configurable.config.write(fp)