Skip to content
Snippets Groups Projects
Commit 89b73bb4 authored by aastorg2's avatar aastorg2
Browse files

script comparing data in json and training data

parent 55a116da
No related branches found
No related tags found
No related merge requests found
import numpy as np
import json
from dtree_synth_gem_stanley import load_partitioned_examples
from gem_stanley_teacher import DTreeGEMStanleyGurobiStabilityTeacher
X_LIM = np.inf
X_ARR = np.array([-X_LIM, X_LIM])
Y_LIM = 1.2
NUM_Y_PARTS = 4
Y_ARR = np.linspace(-Y_LIM, Y_LIM, NUM_Y_PARTS + 1)
YAW_LIM = np.pi / 12
NUM_YAW_PARTS = 10
YAW_ARR = np.linspace(-YAW_LIM, YAW_LIM, NUM_YAW_PARTS + 1)
PARTITION = (X_ARR, Y_ARR, YAW_ARR)
NORM_ORD = 2
ULT_BOUND = 1.0
PKL_FILE_PATH = "data/training/800_truths-uniform_partition_4x20-1.2m-pi_12-one_straight_road-2021-10-27-08-49-17.bag.pickle"
#teacher = DTreeGEMStanleyGurobiStabilityTeacher(norm_ord=NORM_ORD, ultimate_bound=ULT_BOUND)
#part_to_examples = load_partitioned_examples(
# file_name=PKL_FILE_PATH,
# teacher=teacher, partition=PARTITION
# )
JSON_RES_FILE = "exp_results/gem-stability-concat-ult_bound=1.0/dtree_synth.4x10.out.json"
teacher = DTreeGEMStanleyGurobiStabilityTeacher(norm_ord=NORM_ORD, ultimate_bound=ULT_BOUND)
part_to_examples = load_partitioned_examples(
file_name=PKL_FILE_PATH,
teacher=teacher, partition=PARTITION
)
idx1 = 0
data_list = []
for part, dataset in part_to_examples.items():
data_list.append(part)
idx1 += 1
#break
with open(JSON_RES_FILE) as f:
data = json.load(f)
idx = 0
part_res_list = []
for part_w_res in data:
part_res_list.append(part_w_res)
idx += 1
# break
assert len(data_list) == len(part_res_list)
for i in range(0,len(data_list)):
part = data_list[i]
part_res = part_res_list[i]["part"]
#part_copy = tuple()
part_copy = part[0]+ part[1]+ tuple(np.rad2deg(part[2]))
part_res_copy = tuple(part_res[0]) + tuple(part_res[1])+ tuple(np.rad2deg(part_res[2]))
print(part_copy)
#print(part_res)
if part_res_list[i]["status"] != "found":
print(part_res_copy)
print(part_res_list[i]["status"])
#print(part_res_list[i]["status"])
print("-----------------")
#break
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment