BerkeleyAutomation / perception

AUTOLab perception toolkit
https://berkeleyautomation.github.io/perception
Apache License 2.0
69 stars 35 forks source link

Trying out the GQCNN code in Ubuntu 16.04 you get an error due to float coordinates #1

Closed BourbonCreams closed 7 years ago

BourbonCreams commented 7 years ago

Running examples/policy.py the algorithm uses your perception/image.py file but the coordinates in the crop function are float values so the system complains. All it needs is a cast to int for the 4 values like so:

    # crop using PIL
    desired_start_row = int(np.floor(center_i - float(height) / 2))
    desired_end_row = int(np.floor(center_i + float(height) / 2))
    desired_start_col = int(np.floor(center_j - float(width) / 2))
    desired_end_col = int(np.floor(center_j + float(width) / 2))

and it will work. I managed to run the gqcnn code in Ubuntu 14.04 and when I switched to Ubuntu 16.04 it was giving me this error. I believe I had the same libraries installed so even though I am not sure I think the problem has to do with the OS version. Adding this cast shouldn't break the code for Ubuntu 14.04.

jeffmahler commented 7 years ago

Thanks! I just pushed this fix to master. Apologies for the error - it's almost certainly because of a different in the version of either PIL or numpy on 16.04.