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

Keyerror: seg_map_path #133

Open
serendipityshe opened this issue Dec 13, 2024 · 1 comment
Open

Keyerror: seg_map_path #133

serendipityshe opened this issue Dec 13, 2024 · 1 comment

Comments

@serendipityshe
Copy link

When I run inference.py, ERROR:
Loads checkpoint by local backend from path: scd_workdir3\iter_9000.pth
E:\anaconda3\envs\ban_net\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'
E:\anaconda3\envs\ban_net\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 '
E:\anaconda3\envs\ban_net\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(
12/13 17:28:18 - 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.
E:\anaconda3\envs\ban_net\lib\site-packages\mmengine\visualization\visualizer.py:196: UserWarning: Failed to add <class 'opencd.visualization.cd_vis_backend.CDLocalVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
Inference ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Traceback (most recent call last):
File "d:\PROJECT\AI-Project\ChangeDetect\open-cd\predict.py", line 32, in
inferencer(img_pairs, show=False, out_dir=out_dir)
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmseg\apis\mmseg_inferencer.py", line 187, in call
return super().call(
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmengine\infer\infer.py", line 221, in call
for data in (track(inputs, description='Inference')
File "E:\anaconda3\envs\ban_net\lib\site-packages\rich\progress.py", line 168, in track
yield from progress.track(
File "E:\anaconda3\envs\ban_net\lib\site-packages\rich\progress.py", line 1210, in track
for value in sequence:
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmengine\infer\infer.py", line 291, in preprocess
yield from map(self.collate_fn, chunked_data)
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmengine\infer\infer.py", line 588, in _get_chunk_data
processed_data = next(inputs_iter)
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmcv\transforms\base.py", line 12, in call
return self.transform(results)
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmcv\transforms\wrappers.py", line 88, in transform
results = t(results) # type: ignore
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmcv\transforms\base.py", line 12, in call
return self.transform(results)
File "E:\anaconda3\envs\ban_net\lib\site-packages\mmcv\transforms\loading.py", line 345, in transform
self._load_seg_map(results)
File "d:\PROJECT\AI-Project\ChangeDetect\open-cd\opencd\datasets\transforms\loading.py", line 275, in _load_seg_map
results['seg_map_path'], backend_args=self.backend_args)
KeyError: 'seg_map_path'

SCD change detection based on SECOND.The weights(.pt) were obtained by training the SECOND dataset.I gave the above error when I wanted to predict my own dataset.May I ask where I need to add the seg_map_path and what should be placed under the seg_map_path.

@serendipityshe
Copy link
Author

I want to use a trained model to predict changing images,and how can I write scripts to avoid this problem? In the prediction, you should only enter im1, im2 will do.This script works fine with BCD.May I ask what changes I need to make.

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

1 participant