twhui/LiteFlowNet

invalid literal for int() with base 10: "b'1241"

CXMANDTXW opened this issue · 5 comments

I use 'test_iter.py' to test KITTI datasets , model is liteflownet-ft-kitti , and I meet the following error:
Traceback (most recent call last):
File "test_iter.py", line 96, in
img1_size = get_image_size(images[0][idx])
File "test_iter.py", line 15, in get_image_size
dim_list = [int(dimstr) for dimstr in str(subprocess.check_output([img_size_bin, filename])).split(',')]
File "test_iter.py", line 15, in
dim_list = [int(dimstr) for dimstr in str(subprocess.check_output([img_size_bin, filename])).split(',')]
ValueError: invalid literal for int() with base 10: "b'1241"

twhui commented

I have no idea why you had such an error. Did you have any problems when you use test_batch,py for Sintel?

twhui commented

Closed due to inactivity.

I am facing the same error. Please reopen. @twhui

twhui commented

Reopened @thohemp

Solution:

import re

changing
dim_list = [int(dimstr) for dimstr in str(subprocess.check_output([img_size_bin, filename])).split(',')]
to
dim_list = [int(re.sub("\D","",dimstr)) for dimstr in str(subprocess.check_output([img_size_bin, filename])).split(',')]

reference: http://www.programmersought.com/article/1029470187/;jsessionid=BCE5BCEA26650D67DAD393AEE2DA1491