Deep-Alignment-Network-tensorflow icon indicating copy to clipboard operation
Deep-Alignment-Network-tensorflow copied to clipboard

Error TestsetPreparation.py

Open Onotoko opened this issue 7 years ago • 5 comments

Hi, I have an error when run TestsetPreparation.py file: Traceback (most recent call last): File "TestSetPreparation.py", line 19, in commonSet.PrepareData(commonSetImageDirs, commonSetBoundingBoxFiles, meanShape, 0, 1000, False) File "/home/diffdeep/Documents/train_dan/Deep-Alignment-Network-tensorflow-master-2/DAN-TF/ImageServer.py", line 60, in PrepareData boundingBoxDict = pickle.load(open(boundingBoxFiles[i], 'rb')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xd3 in position 0: ordinal not in range(128) Please suggest me some advice. Thanks

Onotoko avatar Jul 03 '18 04:07 Onotoko

In ImageServer.py, turn boundingBoxDict = pickle.load(open(boundingBoxFiles[i], 'rb')) to boundingBoxDict = pickle.load(open(boundingBoxFiles[i], 'rb'), encoding='bytes')

duduOliver avatar Jul 04 '18 03:07 duduOliver

Hi duduOliver, Thank you very much :)

Onotoko avatar Jul 04 '18 03:07 Onotoko

Hi,

I have an error when run TestsetPreparation.py file: File "TestSetPreparation.py", line 20, in commonSet.PrepareData(commonSetImageDirs, commonSetBoundingBoxFiles, meanShape, 0, 1000, False) ImageServer.py", line 70, in PrepareData boundingBoxes.append(boundingBoxDict[basename]) KeyError: 'image_0193.png'

1700117HLT avatar Jan 15 '19 12:01 1700117HLT

Hi,

I have an error when run TestsetPreparation.py file: File "TestSetPreparation.py", line 20, in commonSet.PrepareData(commonSetImageDirs, commonSetBoundingBoxFiles, meanShape, 0, 1000, False) ImageServer.py", line 70, in PrepareData boundingBoxes.append(boundingBoxDict[basename]) KeyError: 'image_0193.png'

Excuse me. Have you solved the problem? I meet the same error with you. Thank you very much!

dapipi0315 avatar Jul 09 '19 11:07 dapipi0315

Hi,

I have an error when run TestsetPreparation.py file: File "TestSetPreparation.py", line 20, in commonSet.PrepareData(commonSetImageDirs, commonSetBoundingBoxFiles, meanShape, 0, 1000, False) ImageServer.py", line 70, in PrepareData boundingBoxes.append(boundingBoxDict[basename]) KeyError: 'image_0193.png'

Excuse me. Have you solved the problem? I meet the same error with you. Thank you very much!

change the dict key to str ,like this :

    boundingBoxDict = {}
    for i in range(len(imageDirs)):
        filenamesInDir = glob.glob(imageDirs[i] + "*.jpg")
        filenamesInDir += glob.glob(imageDirs[i] + "*.png")
        # import pdb; pdb.set_trace()
        if boundingBoxFiles is not None:
            boundingBoxDictTmp = pickle.load(open(boundingBoxFiles[i], 'rb'), encoding='bytes')
            for k,v in boundingBoxDictTmp.items():
                str_tmp = str(k,encoding = "utf8")
                boundingBoxDict[str_tmp] = v

niceweipeng avatar Aug 29 '19 03:08 niceweipeng