open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.38k stars 9.43k forks source link

When I try to verify the installation, error “AttributeError: 'NoneType' object has no attribute 'copy'’’ #10168

Open GarlicPineapple opened 1 year ago

GarlicPineapple commented 1 year ago

When I try to verify the installation, get the errorAttributeError: 'NoneType' object has no attribute 'copy'’ I ran the file 'inference_demo', the error code is visualizer.add_datasample( 'result', img, data_sample=result, draw_gt=False, wait_time=0, ). When I annotate it, the error disappears and can be able to output an unlabeled image,like this image

environment CUDA 11.0 pytorch1.7.1 MVCC 2.0.0rc4 mmdet 3.0.0 mmengine 0.7.2

error ` AttributeError Traceback (most recent call last) /tmp/ipykernel_12220/1880806597.py in 5 data_sample=result, 6 draw_gt=False, ----> 7 wait_time=0, 8 ) 9 visualizer.show()

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmengine/dist/utils.py in wrapper(*args, kwargs) 358 def wrapper(*args, *kwargs): 359 if is_main_process(): --> 360 return func(args, kwargs) 361 362 return wrapper

~/crowdhuman/mmdetection/mmdet/visualization/local_visualizer.py in add_datasample(self, name, image, data_sample, draw_gt, draw_pred, show, wait_time, out_file, pred_score_thr, step) 368 pred_instances.scores > pred_score_thr] 369 pred_img_data = self._draw_instances(image, pred_instances, --> 370 classes, palette) 371 if 'pred_panoptic_seg' in data_sample: 372 assert classes is not None, 'class information is ' \

~/crowdhuman/mmdetection/mmdet/visualization/local_visualizer.py in _draw_instances(self, image, instances, classes, palette) 158 'alpha': 0.8, 159 'pad': 0.7, --> 160 'edgecolor': 'none' 161 }]) 162

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmengine/dist/utils.py in wrapper(*args, kwargs) 358 def wrapper(*args, *kwargs): 359 if is_main_process(): --> 360 return func(args, kwargs) 361 362 return wrapper

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/mmengine/visualization/visualizer.py in draw_texts(self, texts, positions, font_sizes, colors, vertical_alignments, horizontal_alignments, font_families, bboxes, font_properties) 540 family=font_families[i], 541 fontproperties=font_properties[i], --> 542 color=colors[i]) 543 return self 544

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, *kwargs) 356 f"%(removal)s. If any parameter follows {name!r}, they " 357 f"should be pass as keyword, not positionally.") --> 358 return func(args, **kwargs) 359 360 return wrapper

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/axes/_axes.py in text(self, x, y, s, fontdict, withdash, **kwargs) 768 else: 769 t = mtext.Text(x, y, text=s) --> 770 t.update(effective_kwargs) 771 772 t.set_clip_path(self.patch)

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/text.py in update(self, kwargs) 175 sentinel = object() # bbox can be None, so use another sentinel. 176 bbox = kwargs.pop("bbox", sentinel) --> 177 super().update(kwargs) 178 if bbox is not sentinel: 179 self.set_bbox(bbox)

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/artist.py in update(self, props) 1004 1005 with cbook._setattr_cm(self, eventson=False): -> 1006 ret = [_update_property(self, k, v) for k, v in props.items()] 1007 1008 if len(ret):

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/artist.py in (.0) 1004 1005 with cbook._setattr_cm(self, eventson=False): -> 1006 ret = [_update_property(self, k, v) for k, v in props.items()] 1007 1008 if len(ret):

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/artist.py in _update_property(self, k, v) 1001 raise AttributeError('{!r} object has no property {!r}' 1002 .format(type(self).name, k)) -> 1003 return func(v) 1004 1005 with cbook._setattr_cm(self, eventson=False):

~/anaconda3/envs/mmdet/lib/python3.7/site-packages/matplotlib/text.py in set_fontproperties(self, fp) 1222 if isinstance(fp, str): 1223 fp = FontProperties(fp) -> 1224 self._fontproperties = fp.copy() 1225 self.stale = True 1226

AttributeError: 'NoneType' object has no attribute 'copy' `

miaowumonsyer commented 1 year ago

I met the same question!

GarlicPineapple commented 1 year ago

I met the same question!

I still haven't sloved this question in this environment. So I lowered the version of mmdet.

miaowumonsyer commented 1 year ago

I met the same question!

I still haven't sloved this question in this environment. So I lowered the version of mmdet.

what is the version number of mmdet??

GarlicPineapple commented 1 year ago

I met the same question!

I still haven't sloved this question in this environment. So I lowered the version of mmdet.

what is the version number of mmdet??

mmdet 2.25.0 mmcv-full 1.3.17 mmengine 0.7.2

miaowumonsyer commented 1 year ago

I met the same question!

I still haven't sloved this question in this environment. So I lowered the version of mmdet.

what is the version number of mmdet??

mmdet 2.25.0 mmcv-full 1.3.17 mmengine 0.7.2

thanks!

juneodie commented 1 year ago

I faced the same problem when testing the model with mmdetection 3.0.0

fat-921 commented 1 year ago

How do I solve this problem, I work well under liunx, and report this error under Windows

yulongnan commented 1 year ago

I faced the same problem when testing the model with mmdetection 3.0.0 Request the Great God to resolve it???

WjzZwd commented 1 year ago

How do I solve this problem, I work well under liunx, and report this error under Windows

i met the same error and wanna to ask how to do

WjzZwd commented 1 year ago

solved! maybe you install mmdetection through mim so you shouldn't use the first methods to verify the installation 。 you should use the seconde method to verify the installation

pd162 commented 1 year ago

I faced the same problem when testing the model with mmdetection 3.0.0 Request the Great God to resolve it???

I met the same problem, too. I find the version of matplotlib is the key factor. In fact, you can upgrade the version of matplotlib by using pip install matplotlib --upgrade

mokby commented 1 year ago

Thanks!That works perfect!

Ruihyw commented 1 month ago

I faced the same problem when testing the model with mmdetection 3.0.0 Request the Great God to resolve it???

I met the same problem, too. I find the version of matplotlib is the key factor. In fact, you can upgrade the version of matplotlib by using pip install matplotlib --upgrade

thanks! that works!

WjzZwd commented 1 month ago

收到