facebookresearch / fvcore

Collection of common code that's shared among different research projects in FAIR computer vision team.
Apache License 2.0
1.93k stars 226 forks source link

fix shapely deprecation warning #116

Open jveitchmichaelis opened 1 year ago

jveitchmichaelis commented 1 year ago

Fixes deprecation warning as per https://github.com/facebookresearch/fvcore/issues/103.

Linted/blacked + tests pass locally, although I don't believe there is a test case that covers this anyway (the existing transform works, but it will print a warning every time).

PeterMitrano commented 1 year ago

I ran into an error because of this (not a warning) given the following library versions.

shapely==2.0.0
fvcore==0.1.5.post20220512
detectron2 @ git+https://github.com/facebookresearch/detectron2.git@58e472e076a5d861fdcf773d9254a3664e045bf8

This PR fixes the problem for me!

PeterMitrano commented 1 year ago

@ppwwyyxx
@nikhilaravi Can someone take a look at this? It's been up for months and solves an error for me.

The error was getting for reference:

Traceback (most recent call last):
...
  File "/usr/lib/python3/dist-packages/detectron2/data/detection_utils.py", line 310, in transform_instance_annotations
    p.reshape(-1) for p in transforms.apply_polygons(polygons)
  File "/usr/lib/python3/dist-packages/fvcore/transforms/transform.py", line 297, in <lambda>
    return lambda x: self._apply(x, name)
  File "/usr/lib/python3/dist-packages/fvcore/transforms/transform.py", line 291, in _apply
    x = getattr(t, meth)(x)
  File "/usr/lib/python3/dist-packages/fvcore/transforms/transform.py", line 724, in apply_polygons
    for poly in cropped:
TypeError: 'MultiPolygon' object is not iterable