Repository: azavea/raster-vision

Issue:
Randint is passed float bounds
I'm not sure what's causing this, but a user has this stack trace:

```
File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/src/rastervision/__main__.py", line 17, in <module>
    rv.main()
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/src/rastervision/cli/main.py", line 294, in run_command
    rv.runner.CommandRunner.run(command_config_uri)
  File "/opt/src/rastervision/runner/command_runner.py", line 11, in run
    CommandRunner.run_from_proto(msg)
  File "/opt/src/rastervision/runner/command_runner.py", line 17, in run_from_proto
    command.run()
  File "/opt/src/rastervision/command/chip_command.py", line 29, in run
    task.make_chips(train_scenes, val_scenes, augmentors, tmp_dir)
  File "/opt/src/rastervision/task/task.py", line 127, in make_chips
    train_scenes, TRAIN, augment=True)
  File "/opt/src/rastervision/task/task.py", line 124, in _process_scenes
    return [_process_scene(scene, type_, augment) for scene in scenes]
  File "/opt/src/rastervision/task/task.py", line 124, in <listcomp>
    return [_process_scene(scene, type_, augment) for scene in scenes]
  File "/opt/src/rastervision/task/task.py", line 107, in _process_scene
    windows = self.get_train_windows(scene)
  File "/opt/src/rastervision/task/object_detection.py", line 107, in get_train_windows
    self.config.chip_options.label_buffer))
  File "/opt/src/rastervision/task/object_detection.py", line 58, in make_pos_windows
    return _make_chip_pos_windows(image_extent, label_store, chip_size)
  File "/opt/src/rastervision/task/object_detection.py", line 28, in _make_chip_pos_windows
    window = box.make_random_square_container(chip_size)
  File "/opt/src/rastervision/core/box.py", line 121, in make_random_square_container
    rand_x = random.randint(lb, ub)
  File "/opt/conda/lib/python3.6/random.py", line 221, in randint
    return self.randrange(a, b+1)
  File "/opt/conda/lib/python3.6/random.py", line 194, in randrange
    raise ValueError("non-integer stop for randrange()")
ValueError: non-integer stop for randrange()
/tmp/tmpxwof2zeo/tmp_wgvukcn/Makefile:6: recipe for target '1' failed
```


Discussion:

Resolving patch:
diff --git a/rastervision/core/box.py b/rastervision/core/box.py
--- a/rastervision/core/box.py
+++ b/rastervision/core/box.py
@@ -114,11 +114,11 @@ def make_random_square_container(self, size):
 
         lb = self.ymin - (size - self.get_height())
         ub = self.ymin
-        rand_y = random.randint(lb, ub)
+        rand_y = random.randint(int(lb), int(ub))
 
         lb = self.xmin - (size - self.get_width())
         ub = self.xmin
-        rand_x = random.randint(lb, ub)
+        rand_x = random.randint(int(lb), int(ub))
 
         return Box.make_square(rand_y, rand_x, size)
 
@@ -137,11 +137,11 @@ def make_random_square(self, size):
 
         lb = self.ymin
         ub = self.ymax - size
-        rand_y = random.randint(lb, ub)
+        rand_y = random.randint(int(lb), int(ub))
 
         lb = self.xmin
         ub = self.xmax - size
-        rand_x = random.randint(lb, ub)
+        rand_x = random.randint(int(lb), int(ub))
 
         return Box.make_square(rand_y, rand_x, size)
 


Test patch: