rwightman / efficientdet-pytorch

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights
Apache License 2.0
1.58k stars 293 forks source link

torch 1.7 problem #109

Closed MichaelMonashev closed 3 years ago

MichaelMonashev commented 3 years ago

installed effdet 0.1.6

Traceback (most recent call last):
  File "train_bboxes_v2.py", line 20, in <module>
    import effdet
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/__init__.py", line 2, in <module>
    from .bench import DetBenchPredict, DetBenchTrain, unwrap_bench
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/bench.py", line 8, in <module>
    from .anchors import Anchors, AnchorLabeler, generate_detections, MAX_DETECTION_POINTS
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/anchors.py", line 34, in <module>
    from effdet.object_detection import ArgMaxMatcher, FasterRcnnBoxCoder, BoxList, IouSimilarity, TargetAssigner
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/object_detection/__init__.py", line 18, in <module>
    from .box_coder import FasterRcnnBoxCoder
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/object_detection/box_coder.py", line 30, in <module>
    from .box_list import BoxList
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/object_detection/box_list.py", line 40, in <module>
    class BoxList(object):
  File "/home/xxx/.local/lib/python3.7/site-packages/torch/jit/_script.py", line 924, in script
    _compile_and_register_class(obj, _rcb, qualified_name)
  File "/home/xxx/.local/lib/python3.7/site-packages/torch/jit/_script.py", line 64, in _compile_and_register_class
    torch._C._jit_script_class_compile(qualified_name, ast, defaults, rcb)
RuntimeError:
Arguments for call are not valid.
The following variants are available:

  aten::remainder.Scalar_out(Tensor self, Scalar other, *, Tensor(a!) out) -> (Tensor(a!)):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'str'.

  aten::remainder.Scalar(Tensor self, Scalar other) -> (Tensor):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'str'.

  aten::remainder.Tensor_out(Tensor self, Tensor other, *, Tensor(a!) out) -> (Tensor(a!)):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'str'.

  aten::remainder.Tensor(Tensor self, Tensor other) -> (Tensor):
  Expected a value of type 'Tensor' for argument 'self' but instead found type 'str'.

  aten::remainder.int(int a, int b) -> (int):
  Expected a value of type 'int' for argument 'a' but instead found type 'str'.

  aten::remainder.float(float a, float b) -> (float):
  Expected a value of type 'float' for argument 'a' but instead found type 'str'.

  aten::remainder.int_float(int a, float b) -> (float):
  Expected a value of type 'int' for argument 'a' but instead found type 'str'.

  aten::remainder.float_int(float a, int b) -> (float):
  Expected a value of type 'float' for argument 'a' but instead found type 'str'.

  aten::remainder(Scalar a, Scalar b) -> (Scalar):
  Expected a value of type 'number' for argument 'a' but instead found type 'str'.

The original call is:
  File "/home/xxx/.local/lib/python3.7/site-packages/effdet/object_detection/box_list.py", line 149
        """
        if not self.has_field(field):
            raise ValueError('field %s does not exist' % field)
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
        self.data[field] = value
rwightman commented 3 years ago

@MichaelMonashev thanks, new torch versions and torchscript regressions are always a hoot, I'm about to merge a bunch of work into master, I'll see if I can fix it with that before another major release.

MichaelMonashev commented 3 years ago

Very much looking forward to a stable API for efficientdet and similar models. timm has a very user friendly interface and I hope efficientdet will turn out the same way.

Thank you very much for the great work you have done.

MichaelMonashev commented 3 years ago

may be this patch helps

- raise ValueError('field %s does not exist' % field)
+ raise ValueError('field ' + str(field) + ' does not exist')

but I did not test it.