else: if way > 0: color = (1, 0, 0) elif way < 0: color = (0, 0, 1) cv2.line(self.pmap, p1, p2, color, thickness=3) if __name__ == "__main__": import os base_path = os.path.expanduser("~") + "\\random_data" Dataset = dataset_json.Dataset(["direction", "speed", "throttle", "time"]) # direction_comp = Dataset.get_component("speed") # direction_comp.offset = 0 # direction_comp.scale = 3.6 paths = Dataset.load_dos_sorted(f"{base_path}\\donkey\\1\\") sequence_to_study = (2000, 5000) paths = paths[sequence_to_study[0]:sequence_to_study[1]] annotations = np.array([Dataset.load_annotation(path) for path in paths]) directions = annotations[:, 0][:-1] speeds = len(annotations[:, 1]) * [1] dates = annotations[:, -1] delta_times = dates[1:] - dates[:-1]
it += 1 idxs.append(it) return idxs if __name__ == "__main__": import os base_path = os.path.expanduser("~") + "\\random_data" current_file = os.path.abspath(os.getcwd()) model = load_model( os.path.normpath(f"{current_file}..\\test_model\\models\\fe.h5")) Dataset = dataset_json.Dataset(["time"]) dos = f"{base_path}\\json_dataset\\20 checkpoint patch\\" paths = Dataset.load_dos_sorted(dos) initial_len = len(paths) latents = get_latents(Dataset, model, paths) index = 0 del_threshold = 0.1 while index < initial_len: nearests = find_nearest(latents, index=index) if len(nearests) > 0: nearests.sort() nearests = list(reversed(nearests))
for cmp_key in values: if "__" not in cmp_key: to_save[cmp_key] = self.Dataset.get_component( cmp_key).from_string(values[cmp_key]) to_save["dos"] = self.dos to_save["img_path"] = img_path new_annotation_path = self.Dataset.save_annotation_dict( to_save) self.img_paths_mapping[img_path] = new_annotation_path i += 1 break self.window.close() if __name__ == "__main__": import os base_path = os.path.expanduser("~") + "\\random_data" # path = f"{base_path}\\1 ironcar driving\\" # path = 'C:\\Users\\maxim\\recorded_imgs\\0_1600008448.0622997\\' path = f"{base_path}\\test_scene\\0_1611408252.2687962\\" Dataset = dataset_json.Dataset( ["direction", "speed", "throttle", "left_lane", "right_lane"]) output_components = [0, 1, 2, 3, 4] # indexes to labelise labeliser = Labeliser(Dataset, output_components, path, mode="union")
px = self.last_packet.get('pos_x') py = self.last_packet.get('pos_y') pz = self.last_packet.get('pos_z') if (px, py, pz) != self.last_point: self.log(px, py, pz) self.last_point = (px, py, pz) if __name__ == "__main__": model = model_utils.safe_load_model( 'C:\\Users\\maxim\\GITHUB\\AutonomousCar\\test_model\\models\\test_scene.h5', compile=False) model_utils.apply_predict_decorator(model) model.summary() dataset = dataset_json.Dataset( ['direction', 'speed', 'throttle', 'time']) input_components = [1] hosts = ['127.0.0.1', 'donkey-sim.roboticist.dev', 'sim.diyrobocars.fr'] host = hosts[0] port = 9091 window = windowInterface() # create a window config = { 'host': host, 'port': port, 'window': window, 'use_speed': (True, True), 'sleep_time': 0.01, 'PID_settings': [17, 0.5, 0.3, 1.0, 1.0],
import cv2 from custom_modules.datasets import dataset_json if __name__ == "__main__": Dataset = dataset_json.Dataset(["direction", "time"]) paths = Dataset.load_dos_sorted( "C:\\Users\\maxim\\random_data\\ironcar\\ironcar\\") for path in paths: img, annotation = Dataset.load_img_and_annotation(path) img = cv2.resize(img, (480, 360)) cv2.imshow("img", img) cv2.waitKey(1)