yukitsuji / 3D_CNN_tensorflow

KITTI data processing and 3D CNN for Vehicle Detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error for running model_01_deconv.py

ansabsheikh9 opened this issue · comments

HI, I have downloaded the object detection data from kitti (velodyne, calib, label (txt files)). when i try to run it I receive this error.
"File "/home/ansab/Downloads/new/3D_CNN_tensorflow-master/model_01_deconv.py", line 384, in lidar_generator
yield np.array(batch_voxel, dtype=np.float32)[:, :, :, :, np.newaxis], np.array(batch_g_map, dtype=np.float32), np.array(batch_g_cord, dtype=np.float32)
IndexError: too many indices for array
Process finished with exit code 134 (interrupted by signal 6: SIGABRT) "

If i give bach size of 1 and give the 1 data file with car in it it runs. But when there is no label with 'car' in label file it gives this error.
Please Help me with this issue my email is ansabsheikh9@gmail.com
Thank you so much

@ansabsheikh9
As you said, if batch size is 1 and there is no car in some label files, an error would occurs in lidar_generator.

So I think there are two solution.

  1. When training, set batch size over 2.

  2. Edit source code. I think the source code in this project is dirty, you should rewrite if you want to use for your project like below before lidar_generator. by using this, you could extract the files which include cars.

     new_velodynes_path, new_labels_path, new_calibs_path = [], [], []
     for velodynes, labels, calibs in zip(velodynes_path, labels_path, calibs_path):
         proj_velo = None
    
         if calib_path:
             calib = read_calib_file(calibs)
             proj_velo = proj_to_velo(calib)[:, :3]
    
         if label_path:
             places, rotates, size = read_labels(labels, label_type, calib_path=calib_path, is_velo_cam=is_velo_cam, proj_velo=proj_velo)
             if places is not None:
                 new_velodynes_path.append(velodynes)
                 new_labels_path.append(labels)
                 new_calibs_path.append(calibs)
    

thank you so mcuh for your reply,
I filtered data before passing it for training. I am giving the data which contains cars in it.
I am using batch size of 5, on titan x pascal could you please tell me how much time it take for you to train the network. for me its very slow taking almost 8 hours for 7 epochs.

@ansabsheikh9
Could you train the 3d model?
This project is made about 8 months ago, so I forget detail. But probably over 1 day is needed to train 3d model.

could you please explain what is min_value in this code

def center_to_sphere(places, size, resolution=0.50, min_value=np.array([0., -50., -4.5]), scale=4, x=(0, 90), y=(-50, 50), z=(-4.5, 5.5)):
"""Convert object label to Training label for objectness loss"""
x_logical = np.logical_and((places[:, 0] < x[1]), (places[:, 0] >= x[0]))
y_logical = np.logical_and((places[:, 1] < y[1]), (places[:, 1] >= y[0]))
z_logical = np.logical_and((places[:, 2] < z[1]), (places[:, 2] >= z[0]))
xyz_logical = np.logical_and(x_logical, np.logical_and(y_logical, z_logical))
center = places.copy()
center[:, 2] = center[:, 2] + size[:, 0] / 2.
sphere_center = ((center[xyz_logical] - min_value) / (resolution * scale)).astype(np.int32)
return sphere_center

sorry for late reply.
'min_value' means lower limits of each axis (min x, min y, min z).
It is equal to (x[0], y[0], z[0]).
Need to refactoring.

Thnak you for your reply