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

segformer preprocessing problems #19

Open
concrete13377 opened this issue Nov 29, 2023 · 4 comments
Open

segformer preprocessing problems #19

concrete13377 opened this issue Nov 29, 2023 · 4 comments

Comments

@concrete13377
Copy link

concrete13377 commented Nov 29, 2023

python easyportrait\pipelines\demo\image_demo.py "images\2.jpg" "easyportrait\pipelines\local_configs\easyportrait_experiments_v2\segformer-fp\segformer-fp.py" "easyportrait\ckpt\faceparse_segformer-fp-512.pth" --palette=easy_portrait --out-file="result.png"

I got the following error:

mmsegmentation\mmseg\datasets\pipelines\formatting.py", line 281, in __call__
img_meta[key] = results[key]
KeyError: pad_shape

torch==2.1.1
mmcv-full==1.7.1
mmsegmentation==0.30.0
mmcls==0.25.0

I dont have your torch version, but the problem does not seems to be in torch, looks like the config is wrong

@concrete13377
Copy link
Author

the only thing that helped is to replace this line with img_meta[key] = results.get(key, None)

@concrete13377
Copy link
Author

concrete13377 commented Nov 29, 2023

very good results with segformer-1024 model, thanks for your work :)

@CkShibit
Copy link

CkShibit commented Feb 1, 2024

python ./pipelines/demo/image_demo.py "/root/workspace/facefusion/input_source/mmexport1705161230807.jpg" "/root/workspace/easyportrait/pipelines/local_configs/easyportrait_experiments_v2/segformer-fp/segformer-fp.py" "/root/workspace/easyportrait/pipelines/models/segformer-fp-512.pth" --palette=easy_portrait --out-file="ttt.png"
/root/miniconda3/envs/easyportrait/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
warnings.warn(
/root/miniconda3/envs/easyportrait/lib/python3.8/site-packages/mmseg/models/losses/cross_entropy_loss.py:235: 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(
load checkpoint from local path: /root/workspace/easyportrait/pipelines/models/segformer-fp-512.pth
Traceback (most recent call last):
File "./pipelines/demo/image_demo.py", line 46, in
main()
File "./pipelines/demo/image_demo.py", line 40, in main
get_palette(args.palette),
File "/root/miniconda3/envs/easyportrait/lib/python3.8/site-packages/mmseg/core/evaluation/class_names.py", line 324, in get_palette
raise ValueError(f'Unrecognized dataset: {dataset}')
ValueError: Unrecognized dataset: easy_portrait
How to soulve the error??

@hradec
Copy link

hradec commented Feb 15, 2024

try to add the pipelines folder to the top of your PYTHONPATH:

export PYTHONPATH=./pipelines/:$PYTHONPATH

and run again.
This depot has a copy of the mmseg module in the pipelines folder, where they edited the class_names.py to add the easy_portrait palette.
So you have to force python to load the copy version of mmseg module from the pipelines folder, by adding it to the top of PYTHONPATH.

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