Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when generate validation dataset #35

Open
Onotoko opened this issue Jul 13, 2018 · 5 comments
Open

Error when generate validation dataset #35

Onotoko opened this issue Jul 13, 2018 · 5 comments

Comments

@Onotoko
Copy link

Onotoko commented Jul 13, 2018

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
Copy link
Owner

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
Copy link

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
Copy link
Owner

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

@shayxurui
Copy link

shayxurui commented Aug 11, 2018

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
Copy link
Owner

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

Thanks,

Marek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants