Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

训练模型 TypeError: 'numpy.float64' object cannot be interpreted as an integer #316

Open
Schrodingers-Neko opened this issue Nov 26, 2022 · 3 comments

Comments

@Schrodingers-Neko
Copy link

2022-11-26 07:10:58 | INFO | yolox.evaluators.coco_evaluator:171 - Evaluate in main process...
2022-11-26 07:10:58 | INFO | yolox.evaluators.coco_evaluator:204 - Loading and preparing results...
2022-11-26 07:10:59 | INFO | yolox.evaluators.coco_evaluator:204 - DONE (t=0.06s)
2022-11-26 07:10:59 | INFO | pycocotools.coco:362 - creating index...
2022-11-26 07:10:59 | INFO | pycocotools.coco:362 - index created!
2022-11-26 07:10:59 | INFO | yolox.core.trainer:183 - Training of experiment is done and the best AP is 0.00
2022-11-26 07:10:59 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (12568), thread 'MainThread' (17028):
Traceback (most recent call last):

File "yolox_tools\train.py", line 125, in
launch(
└ <function launch at 0x0000022B998C29D0>

File "c:\users\username\genshin_auto_fish\yolox\core\launch.py", line 98, in launch
main_func(*args)
│ └ (╒══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x0000022B9B97C0D0>

File "yolox_tools\train.py", line 110, in main
trainer.train()
│ └ <function Trainer.train at 0x0000022B983CC940>
└ <yolox.core.trainer.Trainer object at 0x0000022B9B9708B0>

File "c:\users\username\genshin_auto_fish\yolox\core\trainer.py", line 72, in train
self.train_in_epoch()
│ └ <function Trainer.train_in_epoch at 0x0000022B9B932280>
└ <yolox.core.trainer.Trainer object at 0x0000022B9B9708B0>

File "c:\users\username\genshin_auto_fish\yolox\core\trainer.py", line 82, in train_in_epoch
self.after_epoch()
│ └ <function Trainer.after_epoch at 0x0000022B9B941E50>
└ <yolox.core.trainer.Trainer object at 0x0000022B9B9708B0>

File "c:\users\username\genshin_auto_fish\yolox\core\trainer.py", line 207, in after_epoch
self.evaluate_and_save_model()
│ └ <function Trainer.evaluate_and_save_model at 0x0000022B9B945160>
└ <yolox.core.trainer.Trainer object at 0x0000022B9B9708B0>

File "c:\users\username\genshin_auto_fish\yolox\core\trainer.py", line 302, in evaluate_and_save_model
ap50_95, ap50, summary = self.exp.eval(
│ │ └ <function Exp.eval at 0x0000022B9B97C8B0>
│ └ ╒══════════════════╤═════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <yolox.core.trainer.Trainer object at 0x0000022B9B9708B0>

File "c:\users\username\genshin_auto_fish\yolox\exp\yolox_base.py", line 288, in eval
return evaluator.evaluate(model, is_distributed, half)
│ │ │ │ └ False
│ │ │ └ False
│ │ └ YOLOX(
│ │ (backbone): YOLOPAFPN(
│ │ (backbone): CSPDarknet(
│ │ (stem): Focus(
│ │ (conv): BaseConv(
│ │ (conv): ...
│ └ <function COCOEvaluator.evaluate at 0x0000022B9B9328B0>
└ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x0000022BA34CC1C0>

File "c:\users\username\genshin_auto_fish\yolox\evaluators\coco_evaluator.py", line 131, in evaluate
eval_results = self.evaluate_prediction(data_list, statistics)
│ │ │ └ tensor([ 0.8768, 0.1399, 16.0000], device='cuda:0')
│ │ └ [{'image_id': 0, 'category_id': 3, 'bbox': [412.74456787109375, 321.55999755859375, 289.51806640625, 108.240966796875], 'scor...
│ └ <function COCOEvaluator.evaluate_prediction at 0x0000022B9B9329D0>
└ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x0000022BA34CC1C0>

File "c:\users\username\genshin_auto_fish\yolox\evaluators\coco_evaluator.py", line 212, in evaluate_prediction
cocoEval = COCOeval(cocoGt, cocoDt, annType[1])
│ │ │ └ ['segm', 'bbox', 'keypoints']
│ │ └ <pycocotools.coco.COCO object at 0x0000022BA1DC33A0>
│ └ <pycocotools.coco.COCO object at 0x0000022B9BD05C10>
└ <class 'yolox.layers.fast_coco_eval_api.COCOeval_opt'>

File "C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\pycocotools\cocoeval.py", line 76, in init
self.params = Params(iouType=iouType) # parameters
│ │ │ └ 'bbox'
│ │ └ <class 'pycocotools.cocoeval.Params'>
│ └ {}
└ <yolox.layers.fast_coco_eval_api.COCOeval_opt object at 0x0000022B9BCAF460>

File "C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\pycocotools\cocoeval.py", line 527, in init
self.setDetParams()
│ └ <function Params.setDetParams at 0x0000022BB5BC7430>
└ <pycocotools.cocoeval.Params object at 0x0000022BA3A7CC40>

File "C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\pycocotools\cocoeval.py", line 507, in setDetParams
self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
│ │ │ │ └ <function round_ at 0x0000022BEFE8A310>
│ │ │ └ <module 'numpy' from 'C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\numpy\init.py'>
│ │ └ <function linspace at 0x0000022BF0050790>
│ └ <module 'numpy' from 'C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\numpy\init.py'>
└ <pycocotools.cocoeval.Params object at 0x0000022BA3A7CC40>

File "<array_function internals>", line 180, in linspace

File "C:\Users\username\anaconda3\envs\ysfish\lib\site-packages\numpy\core\function_base.py", line 120, in linspace
num = operator.index(num)
│ │ └ 10.0
│ └
└ <module 'operator' from 'C:\Users\username\anaconda3\envs\ysfish\lib\operator.py'>

TypeError: 'numpy.float64' object cannot be interpreted as an integer

@Schrodingers-Neko Schrodingers-Neko changed the title operator.py TypeError: 'numpy.float64' object cannot be interpreted as an integer 训练模型 TypeError: 'numpy.float64' object cannot be interpreted as an integer Nov 26, 2022
@870676759
Copy link

请问这个问题解决了吗?

@Schrodingers-Neko
Copy link
Author

没,摆烂了

@judas1995
Copy link

我直接暴力修正 function_base.py,就過了
num = operator.index(int(num))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants