likyoo / open-cd

A Change Detection Repo Standing on the Shoulders of Giants
https://arxiv.org/abs/2407.15317
Apache License 2.0
494 stars 72 forks source link

推理失败 #117

Open readyq opened 3 weeks ago

readyq commented 3 weeks ago

你好,根据您提供的推理代码进行单个图像对的推理,但是得到的结果是全黑色,想问一下如何解决: from opencd.apis import OpenCDInferencer inferencer = OpenCDInferencer(model='configs/changer/changer_ex_r18_512x512_40k_levircd.py', weights='pretrained/ChangerEx_r18-512x512_40k_levircd_20221223_120511.pth', classes=('unchanged', 'changed'), palette=[[0, 0, 0], [255, 255, 255]])

inferencer([['t0.jpg', 't1.jpg']], show=True, out_dir='demo_test')

inferencer([['demo_test/t0.jpg', 'demo_test/t1.jpg']], show=True, out_dir='demo_test') 报错如下: Loads checkpoint by local backend from path: pretrained/ChangerEx_r18-512x512_40k_levircd_20221223_120511.pth C:\Users\vc.conda\envs\openc\lib\site-packages\mmseg\models\decode_heads\decode_head.py:120: UserWarning: For binary segmentation, we suggest usingout_channels = 1 to define the outputchannels of segmentor, and use thresholdto convert seg_logits into a predictionapplying a threshold warnings.warn('For binary segmentation, we suggest using' C:\Users\vc.conda\envs\openc\lib\site-packages\mmseg\models\builder.py:36: UserWarning: build_loss would be deprecated soon, please use mmseg.registry.MODELS.build() warnings.warn('build_loss would be deprecated soon, please use ' C:\Users\vc.conda\envs\openc\lib\site-packages\mmseg\models\losses\cross_entropy_loss.py:250: UserWarning: Default avg_non_ignore is False, if you would like to ignore the certain label and average loss over non-ignore labels, which is the same with PyTorch official cross_entropy, set avg_non_ignore=True. warnings.warn( C:\Users\vc.conda\envs\openc\lib\site-packages\mmseg\structures\sampler\builder.py:11: UserWarning: `build_pi war warnings.warn( 08/25 00:02:27 - mmengine - WARNING - Failed to search registry with scope "opencd" in the "function" registry tree. As a workaround, the current "function" registry in "mmengine" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "opencd" is a correct scope, or whether the registry is initialized. C:\Users\vc\.conda\envs\openc\lib\site-packages\mmengine\visualization\visualizer.py:196: UserWarning: Failed to add <class 'opencd.visualization.cd_vis_backend.CDLocalVisBackend'>, please provide thesave_dir` argument.

屏幕截图 2024-08-25 000709

readyq commented 3 weeks ago

在前期测试和训练都成功运行的