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

Hi, how to solve below error to start training? [email protected] #14

Closed
nissansz opened this issue Mar 29, 2022 · 22 comments
Closed

Hi, how to solve below error to start training? [email protected] #14

nissansz opened this issue Mar 29, 2022 · 22 comments

Comments

@nissansz
Copy link

/usr/local/lib/python3.7/dist-packages/hydra/core/utils.py:148: UserWarning: register_resolver() is deprecated.
See omry/omegaconf#426 for migration instructions.

OmegaConf.register_resolver(name, f)
The current experiment will be tracked as 20220329-134515
Results will be saved in ./experiments/20220329-134515
/usr/local/lib/python3.7/dist-packages/hydra/utils.py:60: UserWarning: OmegaConf.is_none() is deprecated, see omry/omegaconf#547
if OmegaConf.is_none(config):
/usr/local/lib/python3.7/dist-packages/hydra/_internal/utils.py:710: UserWarning: OmegaConf.is_none() is deprecated, see omry/omegaconf#547
if OmegaConf.is_none(v):
/usr/local/lib/python3.7/dist-packages/hydra/_internal/utils.py:577: UserWarning: OmegaConf.is_none() is deprecated, see omry/omegaconf#547
if OmegaConf.is_dict(x) and not OmegaConf.is_none(x):
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/hydra/utils.py", line 109, in instantiate
return target(*args, **final_kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 245, in init
raise ValueError('sampler option is mutually exclusive with '
ValueError: sampler option is mutually exclusive with shuffle

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/content/u-2-net-portrait-master/train.py", line 77, in main
sampler=sampler)
File "/usr/local/lib/python3.7/dist-packages/hydra/utils.py", line 116, in instantiate
).with_traceback(sys.exc_info()[2])
File "/usr/local/lib/python3.7/dist-packages/hydra/utils.py", line 109, in instantiate
return target(*args, **final_kwargs)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 245, in init
raise ValueError('sampler option is mutually exclusive with '
ValueError: Error instantiating/calling 'torch.utils.data.dataloader.DataLoader' : sampler option is mutually exclusive with shuffle

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

@SpeedOfSpin
Copy link

In conf/dataloader/base.yaml set Shuffle=False

@nissansz
Copy link
Author

Thank you, will try later. I want to train for Japanese characters. But after trying to train with u2net, I found that few images such as 12, is better than 100k images.
I want to get clean text like printed paper. Any way to get a good model for such demand?

0_11_30_986__0_11_33_321_0000000000000000000000204_output

0_11_26_014__0_11_28_650_0000000000000000000000202_output
.

0_11_26_014__0_11_28_650_0000000000000000000000202_output
0_11_28_650__0_11_30_986_0000000000000000000000203_output
0_09_11_446__0_09_14_683_0000000000000000000000163_output

0_11_28_650__0_11_30_986_0000000000000000000000203_output

@xuebinqin
Copy link

xuebinqin commented Apr 13, 2022 via email

@nissansz
Copy link
Author

I just want to process subtitle images for ocr.
After trying u2net training, I found, fewer images is much better than more images.
But the result is still similar to binary result. No amazing effect as portraits.

@xuebinqin
Copy link

xuebinqin commented Apr 13, 2022 via email

@nissansz
Copy link
Author

nissansz commented Apr 13, 2022

video is for example, 720x1280
subtitle is 50x1280

@xuebinqin
Copy link

xuebinqin commented Apr 13, 2022 via email

@nissansz
Copy link
Author

I don't know what is the problem and how to improve. You can download below images and try? I tried several image options
train_data30-24.zip

train_data96-24pcs.zip

train_data50-32pcs.zip

0_11_26_014__0_11_28_650_0000000000000000000000202_output
0_11_28_650__0_11_30_986_0000000000000000000000203_output
0_11_30_986__0_11_33_321_0000000000000000000000204_output
0_04_05_340__0_04_06_475_0000000000000000000000069
0_04_06_475__0_04_07_743_0000000000000000000000070
0_09_11_446__0_09_14_683_0000000000000000000000163_output

0_00_21_016__0_00_22_351_0000000000000000000000001
0_00_22_351__0_00_23_819_0000000000000000000000002
0_00_25_187__0_00_28_691_0000000000000000000000003
0_00_52_014__0_00_53_515_0000000000000000000000013

@nissansz
Copy link
Author

I used your original u2net code to train the images.

@nissansz
Copy link
Author

nissansz commented Apr 14, 2022

Hi
I revised it and tried to run, there is error below, cannot continue.
Also, I changed the original image supervisely to DUTS datasets.

/usr/local/lib/python3.7/dist-packages/hydra/_internal/defaults_list.py:251: UserWarning: In 'config': Defaults list is missing _self_. See https://hydra.cc/docs/upgrades/1.0_to_1.1/default_composition_order for more information
warnings.warn(msg, UserWarning)
The current experiment will be tracked as 20220414-010556
Results will be saved in ./experiments/20220414-010556
Error executing job with overrides: []
Cannot instantiate config of type RandomRotation.
Top level config must be an OmegaConf DictConfig/ListConfig object,
a plain dict/list, or a Structured Config class or instance.

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

@nissansz
Copy link
Author

so the model input resolution is also 1280x50? How big is your testing set. You just checked a few samples or checked many samples for example over 100 ones, none of them show significant improvements? It shouldn't be like that. There must be something wrong in your training process. Because according to your results I think your model is not well-trained. You can try to train a bit longer. Before that you can conduct a unit test by overfitting a few (e.g 10 or 100) images to see if the model is able to give you close to 100% accuracy. If not, there must be something wrong in your training process.

On Wed, Apr 13, 2022 at 9:51 AM nissansz @.> wrote: video is for example, 720x1280 subtitle is 1280x50 — Reply to this email directly, view it on GitHub <#14 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORIGVQYCDFQXP2CVPOLVE3UQTANCNFSM5R6PG2IQ . You are receiving this because you commented.Message ID: @.>
-- Xuebin Qin PhD Department of Computing Science University of Alberta, Edmonton, AB, Canada Homepage: https://xuebinqin.github.io/

Check below for comparison
image

@nissansz
Copy link
Author

nissansz commented Apr 14, 2022

Below is result based on training for white text, black border.
u2net_bce_itr_6000_train_1.350097_tar_0.092083.pth
Test on training data 24 images
image

Below is result on other new 10 test images with the same trained model
image

@nissansz
Copy link
Author

nissansz commented Apr 14, 2022

24 trained images, model: u2net_bce_itr_13000_train_1.316536_tar_0.086602.
Is the training result normal? Should I add more background data for training to improve result for other images?

image

@nissansz
Copy link
Author

u2net_bce_itr_20000_train_1.308634_tar_0.085164.pth

image

@nissansz
Copy link
Author

u2net_bce_itr_25000_train_1.304218_tar_0.084869
image

@nissansz
Copy link
Author

u2net_bce_itr_30000_train_1.301915_tar_0.084681

image

@nissansz
Copy link
Author

u2net_bce_itr_58000_train_1.301812_tar_0.084637.pth

image

@nissansz
Copy link
Author

nissansz commented Apr 14, 2022

change from 24pcs to 20000pcs,
resume training from 24pcs model
1000iterations: u2net_bce_itr_1000_train_1.378661_tar_0.108001

image
image
image

@nissansz
Copy link
Author

nissansz commented Apr 16, 2022

By improving training data, I got better results for Chinese subtitle.
Left is binarized, right is from trainded model, but some places are still not clean. Not sure whether need to improve training data by including border color to mask.

image

image

@nissansz
Copy link
Author

Below problem occurrs when training for Japanese part. Some characters gradually disappeared during training, how to improve?

1000 iterations resumed from above Chinese model
image

4000 iterations
image

@nissansz
Copy link
Author

It seems working now.

image

@xuebinqin
Copy link

xuebinqin commented Oct 11, 2022 via email

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