如何解决Loading and preparing results... DONE (t=0.01s) creating index... index created! Running per image evaluation... Evaluate annotation type *bbox* DONE (t=0.53s). Accumulating evaluation results... Traceback (most recent call last): File "tools/train.py", line 133, in <module> main() File "tools/train.py", line 129, in main runner.train() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1721, in train model = self.train_loop.run() # type: ignore File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/loops.py", line 102, in run self.runner.val_loop.run() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/loops.py", line 366, in run metrics = self.evaluator.evaluate(len(self.dataloader.dataset)) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/evaluator/evaluator.py", line 79, in evaluate _results = metric.evaluate(size) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/evaluator/metric.py", line 133, in evaluate _metrics = self.compute_metrics(results) # type: ignore File "/home/wangbei/mmdetection(coco)/mmdet/evaluation/metrics/coco_metric.py", line 512, in compute_metrics coco_eval.accumulate() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/pycocotools-2.0-py3.8-linux-x86_64.egg/pycocotools/cocoeval.py", line 378, in accumulate tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'float'. `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 30235 closing signal SIGTERM ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 30234) of binary: /home/wangbei/anaconda3/envs/Object_mmdetection/bin/python
时间: 2023-10-09 22:17:31 浏览: 278
这是一个错误日志,看起来是在运行目标检测模型时出现的。错误信息显示在使用numpy库时出现了问题,建议检查代码中是否有使用到numpy库的地方,尤其是是否有使用了np.float这个别名,如果有的话,应该使用float代替。此外,还建议检查代码中是否有使用到torch.distributed.elastic.multiprocessing.api,如果有,也需要检查相关的代码是否有问题。最后,可以尝试搜索相关错误信息,看看是否有其他开发者遇到过类似的问题并给出了解决方案。
相关问题
如何解决Loading and preparing results... DONE (t=0.01s) creating index... index created! Running per image evaluation... Evaluate annotation type *bbox* DONE (t=0.44s). Accumulating evaluation results... Traceback (most recent call last): File "tools/train.py", line 133, in <module> main() File "tools/train.py", line 129, in main runner.train() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1721, in train model = self.train_loop.run() # type: ignore File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/loops.py", line 102, in run self.runner.val_loop.run() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/runner/loops.py", line 366, in run metrics = self.evaluator.evaluate(len(self.dataloader.dataset)) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/evaluator/evaluator.py", line 79, in evaluate _results = metric.evaluate(size) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/mmengine/evaluator/metric.py", line 133, in evaluate _metrics = self.compute_metrics(results) # type: ignore File "/home/wangbei/mmdetection(coco)/mmdet/evaluation/metrics/coco_metric.py", line 512, in compute_metrics coco_eval.accumulate() File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/pycocotools-2.0-py3.8-linux-x86_64.egg/pycocotools/cocoeval.py", line 378, in accumulate tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float) File "/home/wangbei/anaconda3/envs/Object_mmdetection/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'float'. `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 29887 closing signal SIGTERM ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 29886) of binary: /home/wangbei/anaconda3/envs/Object_mmdetection/bin/python
这个错误看起来像是在使用numpy时出现了问题。根据错误信息,似乎是在`pycocotools/cocoeval.py`文件中的`np.float`出现了问题。这是因为在NumPy 1.20中,`np.float`被弃用了。为了解决这个问题,你需要将代码中的`np.float`替换为`float`或`np.float64`。
你可以在`pycocotools/cocoeval.py`文件中找到`tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)`这一行代码,将其中的`np.float`替换为`float`或`np.float64`。如果你不确定应该使用哪个,请根据NumPy版本查看官方文档或参考错误信息中提供的链接。
在修改代码后,重新运行程序,应该就可以解决这个问题了。
python tools/analysis_tools/coco_error_analysis.py demo.pkl work_dirs/kk loading annotations into memory... Done (t=0.32s) creating index... index created! Loading and preparing results... Traceback (most recent call last): File "tools/analysis_tools/coco_error_analysis.py", line 339, in <module> main() File "tools/analysis_tools/coco_error_analysis.py", line 329, in main analyze_results( File "tools/analysis_tools/coco_error_analysis.py", line 253, in analyze_results cocoDt = cocoGt.loadRes(res_file) File "/home/linux/anaconda3/envs/openmmlab/lib/python3.8/site-packages/pycocotools/coco.py", line 320, in loadRes anns = json.load(f) File "/home/linux/anaconda3/envs/openmmlab/lib/python3.8/json/__init__.py", line 293, in load return loads(fp.read(), File "/home/linux/anaconda3/envs/openmmlab/lib/python3.8/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
这个错误是由于读取的文件编码不是UTF-8,而是包含了不支持的字符。您需要检查demo.pkl和res_file这两个文件的编码格式,确保它们都是UTF-8格式。如果不是UTF-8格式,可以使用Python的codecs模块来打开文件并指定正确的编码格式。例如:
```python
import codecs
with codecs.open('demo.pkl', 'r', encoding='gbk') as f:
# do something with the file
```
另外,该错误也可能是由于文件损坏或不完整导致的。您可以尝试重新下载或重新生成这些文件,然后再运行程序。
阅读全文
相关推荐
















