MarekKowalski / DeepAlignmentNetwork

A deep neural network for face alignment
MIT License
509 stars 138 forks source link

Error when generate validation dataset #35

Open Onotoko opened 6 years ago

Onotoko commented 6 years ago

Hi friends, I got an error: Traceback (most recent call last): File "TrainingSetPreparation.py", line 21, in validationSet.PrepareData(imageDirs, boundingBoxFiles, meanShape, 0, 100, False) File "/home/diffdeep/Documents/DiffCat/face_landmarks/face_landmarks/ImageServer.py", line 71, in PrepareData boundingBoxes.append(boundingBoxDict[basename]) KeyError: 'image_0295.png' Please help me! Thanks

MarekKowalski commented 6 years ago

Hi, It seems like the bounding box data for the filename you specified is not there. Check if you are specifying the correct bounding box file for the given dataset, this happens in the two lines shown below:

imageDirs = ["../data/images/lfpw/trainset/", "../data/images/helen/trainset/", "../data/images/afw/"]
boundingBoxFiles = ["../data/boxesLFPWTrain.pkl", "../data/boxesHelenTrain.pkl", "../data/boxesAFW.pkl"]

Thanks,

Marek

shayxurui commented 6 years ago

hello,friend. thanks for share ur code. i meet same KeyError,just as Onoto has meet. and i have checked the imageDirs and boundingBoxFiles,everything is unmodified,and unzip the dataset to designated folder.

And i want to rewrite ur code in pytorch,could u give me some support.thanks

MarekKowalski commented 6 years ago

Hi,

Have you done some standard debugging on this? For example:

If you have any specific question about the method that would help your pytorch implementation I will be more than happy to answer.

Thanks,

Marek

shayxurui commented 6 years ago

to solve this problem , you need to modify those code:

     if boundingBoxFiles is not None:
                basename = path.basename(filenamesInDir[j])
                boundingBoxes.append(boundingBoxDict[basename])

to:

      if boundingBoxFiles is not None:
                basename = path.basename(filenamesInDir[j])
                basename=bytes(basename,encoding='utf-8')
                boundingBoxes.append(boundingBoxDict[basename])  

cause the key of boundingBoxDict is encoding in bytes,but the type of basename is string ,so you need transform the type of basename from string to bytes .it will work.

MarekKowalski commented 6 years ago

Good find! Do you want to submit a PR for this?

Thanks,

Marek