Example #1
0
def main():
    from core.kitti import KITTI, ALL_OBJECTS, CARS_ONLY
    DS_DIR = '/home/salam/datasets/KITTI/training'
    reader = KITTI(DS_DIR, CARS_ONLY)
    ids = reader.get_ids('train')
    for t in [ids[4]]:
        img = reader.get_image(t)
        pts, ref = reader.get_velo(t, use_fov_filter=False)
        boxes_2D = reader.get_boxes_2D(t)
        boxes_3D = reader.get_boxes_3D(t)
        P2 = reader.get_calib(t)[2]

        for b in boxes_3D:
            b.text = f"{np.random.uniform(0.0, 1.0, (1,))[0]:0.2f}"

        imshow(bev(pts, pred_boxes=boxes_3D, title="GT"))
LEARNING_RATE = configs['hyperparams']['lr']
EPOCHS = configs['hyperparams']['epochs']
NUM_THREADS = configs['hyperparams']['num_threads']
MAX_Q_SIZE = configs['hyperparams']['max_q_size']

# Create dirs
OUTPUTS_DIR = os.path.join('new_outputs')
CKPTS_DIR = os.path.join(OUTPUTS_DIR, configs['ckpts_dir'])

for d in [OUTPUTS_DIR, CKPTS_DIR]:
    print("Creating directory: " + d)
    os.makedirs(d, exist_ok=True)

kitti = KITTI(DS_DIR, configs['training_target'])

train_ids = kitti.get_ids('train')
val_ids = kitti.get_ids('val')
micro_ids = kitti.get_ids('micro')

pc_encoder = configs['pc_encoder']

target_encoder = configs['target_encoder']

pprint.pprint(configs['stats'])

logdir = "{0}/logs/".format(CKPTS_DIR) + datetime.now().strftime(
    "%m-%d-%H-%M") + configs['exp_name']
scalar_logdir = logdir + "/scalars/"
file_writer = tf.summary.create_file_writer(scalar_logdir)
file_writer.set_as_default()
Example #3
0
    https://math.stackexchange.com/questions/1472049/check-if-a-point-is-inside-a-rectangular-shaped-area-3d
    https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
    https://stackoverflow.com/questions/1211212/how-to-calculate-an-angle-from-three-points
    https://stackoverflow.com/questions/20677795/how-do-i-compute-the-intersection-point-of-two-lines
    https://www.cs.hmc.edu/ACM/lectures/intersections.html
    https://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/collisions/rectangle_in_triangle.html
    https://math.stackexchange.com/questions/3210769/how-do-i-check-if-a-3d-point-is-between-2-other-3d-points
    https://math.stackexchange.com/questions/208577/find-if-three-points-in-3-dimensional-space-are-collinear
    https://forum.thegamecreators.com/thread/179559#

'''

DS_DIR = '/home/salam/datasets/KITTI/training'
reader = KITTI(DS_DIR, CARS_ONLY)

ids = reader.get_ids('train')


def check_colinear(a, b, c):
    ab = b - a
    ac = c - a
    cross = np.cross(ab, ac)
    if cross.all() < 1e-12:
        # print(cross)
        # print(a, b, c)
        return True
    return False


def get_angle_between_two_vectors(src, p2, p3):
    a = src - p2