DeepAlignmentNetwork icon indicating copy to clipboard operation
DeepAlignmentNetwork copied to clipboard

Error when generate validation dataset

Open Onotoko opened this issue 6 years ago • 5 comments

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

Onotoko avatar Jul 13 '18 08:07 Onotoko

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

MarekKowalski avatar Jul 15 '18 17:07 MarekKowalski

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

shayxurui avatar Aug 07 '18 14:08 shayxurui

Hi,

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

  • check which .npz file that happens in,
  • check whether that file exists,
  • check whether this is the correct bounding box file for that directory.

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

MarekKowalski avatar Aug 09 '18 12:08 MarekKowalski

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.

shayxurui avatar Aug 11 '18 13:08 shayxurui

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

Thanks,

Marek

MarekKowalski avatar Aug 14 '18 15:08 MarekKowalski