Xharlie / BtcDet

Behind the Curtain: Learning Occluded Shapes for 3D Object Detection
Apache License 2.0
195 stars 42 forks source link

ImportError: cannot import name 'add_flops_counting_methods' from 'ptflops.flops_counter' #25

Open sangjun7997 opened 2 years ago

sangjun7997 commented 2 years ago

Even though I have installed ptflops using pip, I cannot train by this problem..

~/BtcDet/tools$ python3 train.py --cfg_file ./cfgs/model_configs/btcdet_kitti_car.yaml --output_dir ../output/kitti_car/ --batch_size 2 --gpu_str "0" Traceback (most recent call last): File "train.py", line 6, in from test import repeat_eval_ckpt File "/home/server10/BtcDet/tools/test.py", line 17, in from eval_utils import eval_utils as eval_utils File "/home/server10/BtcDet/tools/eval_utils/eval_utils.py", line 10, in from ptflops.flops_counter import add_flops_counting_methods ImportError: cannot import name 'add_flops_counting_methods' from 'ptflops.flops_counter' (/home/server10/.local/lib/python3.8/site-packages/ptflops/flops_counter.py)

How can I handle this error?

JinSeoung-Oh commented 2 years ago

Plz, check this repo : https://github.com/sovrasov/flops-counter.pytorch/blob/master/ptflops/flops_counter.py In this repo, there is no 'add_flops_counting_methods' function So, I checked train.py and realized 'ptlflops.flops_counter' is not need to run train.py

I changed from ptflops.flops_counter import add_flops_counting_methods to

from ptflops.flops_counter import add_flops_counting_methods (add # Maybe you know what I mean)

I solved this problem

I hope it will be work on your env

sangjun7997 commented 2 years ago

주석처리 하라는 말씀이시죠?

JinSeoung-Oh commented 2 years ago

어우.. 한국분이시네요ㅋㅋ

네 맞습니다. 그거 하고나니 돌아가던데요? 제가 저거 답은 처음 달아봐서 # 넣었더니 볼드 처리 되네요...ㅋㅋㅋ

2022년 4월 22일 (금) 오후 2:56, Sangjun Lee @.***>님이 작성:

주석처리 하라는 말씀이시죠?

— Reply to this email directly, view it on GitHub https://github.com/Xharlie/BtcDet/issues/25#issuecomment-1106037150, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASXO7EZQH6S6RRQU4XRNGX3VGI5PRANCNFSM5SOQC7PQ . You are receiving this because you commented.Message ID: @.***>

sangjun7997 commented 2 years ago

네 ㅋㅋㅋ 답변 감사합니다

123jyw commented 2 years ago

Can you explain how to change it?

JinSeoung-Oh commented 2 years ago

Put #from ptflops.flops_counter import add_flops_counting_methods. That line don't need to run this model

2022년 5월 18일 (수) 오후 9:45, 123jyw @.***>님이 작성:

Can you explain how to change it?

— Reply to this email directly, view it on GitHub https://github.com/Xharlie/BtcDet/issues/25#issuecomment-1129960466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASXO7E74VTXCBSX6RCTVE2LVKTQ47ANCNFSM5SOQC7PQ . You are receiving this because you commented.Message ID: @.***>