Skip to content

python3 fixes for download_train.py #2

Description

@rbarman

A few fixes are required to download_train.py if anyone is using python3.

Current dependency versions (using google colab):

  • python : 3.6.7
  • opencv-python : 3.4.5.20

Fixes:

  1. Use urllib.request instead urllib
    - see https://stackoverflow.com/questions/3969726/attributeerror-module-object-has-no-attribute-urlopen
  2. Open the csvs with 'r' instead of 'rb'
    - see https://stackoverflow.com/a/28974410/2475380
  3. cv2 needs integers when resizing
    - I get TypeError: integer argument expected, got float when trying to resize images in download_and_resize()
    - One solution is to use integer division like: height = (640 * img.shape[0]) // img.shape[1]

I have these changes ready. However I am not sure I should send in a pull request if the main users in this repo use python2.7 and these changes would cause them issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions