Skip to content

IndexError when runing data_preparation.py #10

@li-fang

Description

@li-fang

Hi! I tried to train the network on my own datasets. When I was preparing the landmarks by running the script "python data_preparation.py --img_folder <folder_to_training_images>", I got the following error message for one of the images:

Traceback (most recent call last):
File "data_preparation.py", line 48, in
data_prepare([os.path.join(opt.data_root, folder) for folder in opt.img_folder], opt.mode)
File "data_preparation.py", line 28, in data_prepare
detect_68p(img_folder, lm_sess, input_op, output_op) # detect landmarks for images
File "D:\Code\Python\Deep3DFaceRecon_pytorch\util\detect_lm68.py", line 105, in detect_68p
draw_landmarks(img, landmark, os.path.join(vis_path, name))
File "D:\Code\Python\Deep3DFaceRecon_pytorch\util\detect_lm68.py", line 29, in draw_landmarks
:] = np.array([0, 0, 255])
IndexError: index 432 is out of bounds for axis 0 with size 432

I changed corresponding index "img.shape[0]-landmark[i, 1]+j" to "img.shape[0]-1-landmark[i, 1]+j". And the above error didn't occur for the next try. I'm not sure if that's what you really meant.

BTW, thanks for sharing your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions