예제 #1
0
파일: str.py 프로젝트: ywyw/pelops
    def __set_chips(self):
        directory = self.__filepaths.dir_all
        for file in os.listdir(directory):
            path = directory + '/' + file

            # Only interested in certain files
            is_valid = os.path.isfile(path)
            is_png = path.endswith(".png")
            is_mask = "mask" in path
            if not is_valid or not is_png or is_mask:
                continue

            # Set all Chip variables
            car_id = get_sa_car_id(path)
            cam_id = get_sa_cam_id(path)

            time = None    # No timestamp information
            misc = None    # No miscellaneous information

            # Make chip
            current_chip = chip.Chip(
                path,
                car_id,
                cam_id,
                time,
                misc
            )

            self.chips[path] = current_chip
예제 #2
0
파일: veri.py 프로젝트: ywyw/pelops
    def __create_chip(self, img_dir, img_name):
        # information about the chip resides in the chip's name
        splitter = img_name.split("_")
        misc = dict()

        filepath = img_dir + "/" + img_name
        car_id = int(splitter[0])
        cam_id = int(utils.get_numeric(splitter[1]))
        time = datetime.datetime.fromtimestamp(int(splitter[2]))
        misc["binary"] = int(os.path.splitext(splitter[3])[0])

        return chip.Chip(filepath, car_id, cam_id, time, misc)
예제 #3
0
파일: slice.py 프로젝트: xiuxi/pelops
    def __create_chip(self, file_info, truth_value):
        """Converts parsing / indexing results into a pelops.datasets.chip.Chip object"""
        if truth_value == 0:
            self.__noise_seq += 1
            car_id = 'unk-{:09d}'.format(self.__noise_seq)
        else:
            car_id = 'tgt-{:09d}'.format(truth_value)

        chip_params = [
            file_info['file'], car_id, file_info['meta']['obSetName'],
            file_info['meta']['epoch'], file_info['meta']
        ]
        return chip.Chip(*chip_params)
예제 #4
0
파일: compcar.py 프로젝트: ywyw/pelops
    def __create_chip(self, img_dir, img_name):
        splitter = img_name.split("/")
        misc = dict()

        filepath = img_dir + "/" + img_name
        car_id = int(splitter[0])
        cam_id = None
        time = None
        misc["color"] = self.__color_map[img_name]
        make, model, model_id = self.__model_map[car_id]
        misc["make"] = make
        misc["model"] = model
        misc["model_id"] = model_id

        return chip.Chip(filepath, car_id, cam_id, time, misc)
예제 #5
0
파일: veri.py 프로젝트: xiuxi/pelops
    def __create_chip(self, img_dir, img_name):
        # information about the chip resides in the chip's name
        splitter = img_name.split("_")
        misc = {}

        filepath = os.path.join(img_dir, img_name)
        car_id = int(splitter[0])
        cam_id = int(utils.get_numeric(splitter[1]))
        time = datetime.datetime.fromtimestamp(int(splitter[2]))
        misc["binary"] = int(os.path.splitext(splitter[3])[0])

        color, vehicle_type = self.__color_type.get(car_id, (None, None))
        misc["color"] = color
        misc["vehicle_type"] = vehicle_type

        return chip.Chip(filepath, car_id, cam_id, time, misc)
예제 #6
0
파일: dgcars.py 프로젝트: ywyw/pelops
    def __set_chips(self):
        # identify all the chips, default query to all
        name_filepath = {
            utils.SetType.ALL.value: self.__filepaths.all_list,
            utils.SetType.TEST.value: self.__filepaths.test_list,
            utils.SetType.TRAIN.value: self.__filepaths.train_list,
        }.get(self.set_type, self.__filepaths.all_list)

        # create chip objects based on the names listed in the files
        for dg_chip in utils.read_json(name_filepath):
            filepath = os.path.normpath(os.path.join(self.dataset_path, dg_chip["filename"]))
            car_id = None
            cam_id = None
            time = None
            misc = dg_chip
            current_chip = chip.Chip(filepath, car_id, cam_id, time, misc)

            self.chips[filepath] = current_chip