Commit fdb9c687 authored by qianyizhang's avatar qianyizhang Committed by Francisco Massa

fix python2 compatibility (#662)

* fix py2

* fix py2
parent 59d445df
import cv2 import cv2
import copy
import torch import torch
import numpy as np import numpy as np
from maskrcnn_benchmark.layers.misc import interpolate from maskrcnn_benchmark.layers.misc import interpolate
...@@ -195,7 +195,7 @@ class PolygonInstance(object): ...@@ -195,7 +195,7 @@ class PolygonInstance(object):
polygons = valid_polygons polygons = valid_polygons
elif isinstance(polygons, PolygonInstance): elif isinstance(polygons, PolygonInstance):
polygons = polygons.polygons.copy() polygons = copy.copy(polygons.polygons)
else: else:
RuntimeError( RuntimeError(
...@@ -523,7 +523,9 @@ class SegmentationMask(object): ...@@ -523,7 +523,9 @@ class SegmentationMask(object):
next_segmentation = self.__getitem__(self.iter_idx) next_segmentation = self.__getitem__(self.iter_idx)
self.iter_idx += 1 self.iter_idx += 1
return next_segmentation return next_segmentation
raise StopIteration raise StopIteration()
next = __next__ # Python 2 compatibility
def __repr__(self): def __repr__(self):
s = self.__class__.__name__ + "(" s = self.__class__.__name__ + "("
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment