SiamFC-PyTorch
SiamFC-PyTorch copied to clipboard
TypeError: a bytes-like object is required, not 'NoneType'
Traceback (most recent call last):
File "bin/train_siamfc.py", line 9, in
I also meet the problem, have you issued?
sorry, I didn't solve it, I print the value img_buffer and it was null, I guess the problem maybe is that the decode of the dataset is not mapping, and I don't know how to do
------------------ 原始邮件 ------------------ 发件人: "DavidZhangdw"[email protected]; 发送时间: 2019年9月16日(星期一) 上午9:24 收件人: "StrangerZhang/SiamFC-PyTorch"[email protected]; 抄送: "C10"[email protected]; "Author"[email protected]; 主题: Re: [StrangerZhang/SiamFC-PyTorch] TypeError: a bytes-like object isrequired, not 'NoneType' (#29)
I also meet the problem, have you issued?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@StrangerZhang
I guess that it may be caused by the change of the filefolder path.
Plz note that when you create the lmdb you need to send the path md5 as the key. So if you change the ".lmdb" path, you need to change the generated key for further query. (Or you will get nothing for the false key you get.)
Also note that :
def imread(self, path):
key = hashlib.md5(path.encode()).digest()
img_buffer = self.txn.get(key)
img_buffer = np.frombuffer(img_buffer, np.uint8)
img = cv2.imdecode(img_buffer, cv2.IMREAD_COLOR)
return img
If you change the .lmdb filefolder path, you should change the path to the original path when you use a different filedir. ( Before key = hashlib.md5(path.encode()).digest()
)