Megvii-BaseDetection / YOLOX

YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with MegEngine, ONNX, TensorRT, ncnn, and OpenVINO supported. Documentation: https://yolox.readthedocs.io/
Apache License 2.0
9.47k stars 2.21k forks source link

raise ImportError("{} doesn't contains class named 'Exp'".format(exp_file)) ImportError: exps/default/nano.py doesn't contains class named 'Exp' #784

Open feizaizcy opened 3 years ago

feizaizcy commented 3 years ago

li@li-desktop:~/Desktop/YOLOX-main$ python3 tools/demo.py image -f exps/default/nano.py -c yolox_nano.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu

Traceback (most recent call last): File "/home/li/Desktop/YOLOX-main/yolox/exp/build.py", line 13, in get_exp_by_file current_exp = importlib.import_module(os.path.basename(exp_file).split(".")[0]) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 674, in exec_module File "", line 781, in get_code File "", line 741, in source_to_code File "", line 219, in _call_with_frames_removed File "exps/default/nano.py", line 36 backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels, self.act, depthwise=True) ^ SyntaxError: positional argument follows keyword argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/demo.py", line 312, in exp = get_exp(args.exp_file, args.name) File "/home/li/Desktop/YOLOX-main/yolox/exp/build.py", line 51, in get_exp return get_exp_by_file(exp_file) File "/home/li/Desktop/YOLOX-main/yolox/exp/build.py", line 16, in get_exp_by_file raise ImportError("{} doesn't contains class named 'Exp'".format(exp_file)) ImportError: exps/default/nano.py doesn't contains class named 'Exp'

1

feizaizcy commented 3 years ago

In the same situation I can run the yolox-s and yolox-tiny model but I can't run the nano model

RangerOnMars commented 3 years ago

I met the same issue as yours. I solved that by using nano.py from previous release version. Hope that'll be helpful .

feizaizcy commented 3 years ago

Thank you very much it’s useful

wallds commented 3 years ago

766

lleesg commented 3 years ago

解决方案:https://github.com/Megvii-BaseDetection/YOLOX/issues/454#issuecomment-953764724

FateScript commented 3 years ago

please pull our latest update, this bug is fixed now.

abushattal1 commented 3 years ago

please pull our latest update, this bug is fixed now.

Hi, I have updated the nano.py code but i still have the same problem.... any suggestion

diaozhuo99 commented 2 years ago

改称绝对路径就好了