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

PPLCNetNew找不到對應模型 #10685

Closed
cjwang0318 opened this issue Aug 21, 2023 · 19 comments
Closed

PPLCNetNew找不到對應模型 #10685

cjwang0318 opened this issue Aug 21, 2023 · 19 comments
Labels
PR is welcome training this is a training related issue triaged this issue has been looked, and triaged.

Comments

@cjwang0318
Copy link

  • 系统环境/System Environment:Ubuntu
  • 版本号/Version:Paddle v2.5: PaddleOCR: 问题相关组件/Related components: ppocr/modeling/necks/db_fpn.py
  • 运行指令/Command Code:python tools/train.py -c ./ch_PP-OCRv4_det_cml.yml

使用ch_PP-OCRv4_det訓連模型進行fintune時,將 ch_PP-OCRv4_det_cml.yml 中的 Backbone name: PPLCNetNew 找不到對應模型,如果改成PPLCNetNewV3則會報錯 for i in range(len(in_channels)):TypeError: object of type 'int' has no len()
可以麻煩請教一下原因嗎?謝謝。

  • 完整报错/Complete Error Message:

  • Traceback (most recent call last):
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/tools/train.py", line 227, in
    main(config, device, logger, vdl_writer)
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/tools/train.py", line 135, in main
    model = build_model(config['Architecture'])
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/ppocr/modeling/architectures/init.py", line 34, in build_model
    arch = getattr(mod, name)(config)
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/ppocr/modeling/architectures/distillation_model.py", line 47, in init
    model = BaseModel(model_config)
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/ppocr/modeling/architectures/base_model.py", line 67, in init
    self.neck = build_neck(config['Neck'])
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/ppocr/modeling/necks/init.py", line 42, in build_neck
    module_class = eval(module_name)(**config)
    File "/home/cjwang/cjwang/PaddleOCR-release-2.7/ppocr/modeling/necks/db_fpn.py", line 240, in init
    for i in range(len(in_channels)):
    TypeError: object of type 'int' has no len()

@SWHL
Copy link
Collaborator

SWHL commented Aug 26, 2023

I meet the same problem.

@gl94
Copy link

gl94 commented Sep 4, 2023

不是“PPLCNetNewV3”而是“PPLCNetV3”

@Taichipeace
Copy link

不是“PPLCNetNewV3”而是“PPLCNetV3”

PPLCNetV3 我改成了这个,但是也是一样的报错。

@kadimakipp
Copy link

kadimakipp commented Oct 13, 2023

把PPLCNetNew改成PPLCNetV3,在添加一行det: true
image

@enemy1205
Copy link

添加det: true后,
训练会遇到另外报错

Traceback (most recent call last):
  File "/mnt/home/sp/projects/PaddleOCR/tools/train.py", line 228, in <module>
    main(config, device, logger, vdl_writer)
  File "/mnt/home/sp/projects/PaddleOCR/tools/train.py", line 199, in main
    program.train(config, train_dataloader, valid_dataloader, device, model,
  File "/mnt/home/sp/projects/PaddleOCR/tools/program.py", line 334, in train
    post_result = post_process_class(preds, batch[1])
  File "/mnt/home/sp/projects/PaddleOCR/ppocr/postprocess/db_postprocess.py", line 275, in __call__
    results[k] = self.post_process(predicts[k], shape_list=shape_list)
  File "/mnt/home/sp/projects/PaddleOCR/ppocr/postprocess/db_postprocess.py", line 229, in __call__
    src_h, src_w, ratio_h, ratio_w = shape_list[batch_index]
ValueError: too many values to unpack (expected 4)
I1013 19:03:27.982057 679392 tcp_store.cc:273] receive shutdown event and so quit from MasterDaemon run loop

调试进入
ppocr/postprocess/db_postprocess.py文件中229lines

        for batch_index in range(pred.shape[0]):
            src_h, src_w, ratio_h, ratio_w = shape_list[batch_index]
            if self.dilation_kernel is not None:
                mask = cv2.dilate(
                    np.array(segmentation[batch_index]).astype(np.uint8),
                    self.dilation_kernel)

发现shappe_list是一个 batch_size * 640(height) *640(width) 的数组,
显然下标访问后取值无法返回src_h, src_w, ratio_h, ratio_w

@kadimakipp
Copy link

#5710

@ITccyhub
Copy link

ITccyhub commented Nov 7, 2023

Traceback (most recent call last):
File "tools/train.py", line 227, in
main(config, device, logger, vdl_writer)
File "tools/train.py", line 135, in main
model = build_model(config['Architecture'])
File "D:\PaddleOCR\PaddleOCR-release-2.7\ppocr\modeling\architectures_init_.py", line 34, in build_model
arch = getattr(mod, name)(config)
File "D:\PaddleOCR\PaddleOCR-release-2.7\ppocr\modeling\architectures\distillation_model.py", line 47, in init
model = BaseModel(model_config)
File "D:\PaddleOCR\PaddleOCR-release-2.7\ppocr\modeling\architectures\base_model.py", line 67, in init
self.neck = build_neck(config['Neck'])
File "D:\PaddleOCR\PaddleOCR-release-2.7\ppocr\modeling\necks_init_.py", line 42, in build_neck
module_class = eval(module_name)(**config)
File "D:\PaddleOCR\PaddleOCR-release-2.7\ppocr\modeling\necks\db_fpn.py", line 240, in init
for i in range(len(in_channels)):
TypeError: object of type 'int' has no len()

@ITccyhub
Copy link

ITccyhub commented Nov 7, 2023

image
an'zh按照这个改了还是报错

@ITccyhub
Copy link

ITccyhub commented Nov 7, 2023

加上 det: true 直接
image

@sylarwcy
Copy link
Contributor

把PPLCNetNew改成PPLCNetV3,在添加一行det: true image

这个是正解

@sylarwcy
Copy link
Contributor

1115
image

只有设定了det: true,才能走输出序列这个条件分支。后面RSEFPN解析in_channels时,按序列来解,才不会报错。

@KongXCai
Copy link

添加det: true后, 训练会遇到另外报错

Traceback (most recent call last):
  File "/mnt/home/sp/projects/PaddleOCR/tools/train.py", line 228, in <module>
    main(config, device, logger, vdl_writer)
  File "/mnt/home/sp/projects/PaddleOCR/tools/train.py", line 199, in main
    program.train(config, train_dataloader, valid_dataloader, device, model,
  File "/mnt/home/sp/projects/PaddleOCR/tools/program.py", line 334, in train
    post_result = post_process_class(preds, batch[1])
  File "/mnt/home/sp/projects/PaddleOCR/ppocr/postprocess/db_postprocess.py", line 275, in __call__
    results[k] = self.post_process(predicts[k], shape_list=shape_list)
  File "/mnt/home/sp/projects/PaddleOCR/ppocr/postprocess/db_postprocess.py", line 229, in __call__
    src_h, src_w, ratio_h, ratio_w = shape_list[batch_index]
ValueError: too many values to unpack (expected 4)
I1013 19:03:27.982057 679392 tcp_store.cc:273] receive shutdown event and so quit from MasterDaemon run loop

调试进入 ppocr/postprocess/db_postprocess.py文件中229lines

        for batch_index in range(pred.shape[0]):
            src_h, src_w, ratio_h, ratio_w = shape_list[batch_index]
            if self.dilation_kernel is not None:
                mask = cv2.dilate(
                    np.array(segmentation[batch_index]).astype(np.uint8),
                    self.dilation_kernel)

发现shappe_list是一个 batch_size * 640(height) *640(width) 的数组, 显然下标访问后取值无法返回src_h, src_w, ratio_h, ratio_w

我也遇到了跟你一样的问题,请问你解决了吗?

@Sundragon1993
Copy link

@KongXCai just set: cal_metric_during_train: false

@Double97828
Copy link

把PPLCNetNew改成PPLCNetV3,在添加一行det: true image

这个student1和student2都要做修改么,我两个都修改了以后,有非常多层的参数无法加载不到模型中

@koala-cat
Copy link

把PPLCNetNew改成PPLCNetV3,在添加一行det: true image

这个student1和student2都要做修改么,我两个都修改了以后,有非常多层的参数无法加载不到模型中

解决了么?我也是PPLCNetNew改成PPLCNetV3之后,student1和student2都加了 det: true,也试过单独加 student1,结果还是报错
1712718092497

@jzhang533 jzhang533 added triaged this issue has been looked, and triaged. training this is a training related issue PR is welcome labels Apr 10, 2024
@nikooooooooooooooooooo
Copy link

nikooooooooooooooooooo commented May 10, 2024

配置加上还是报错,大佬解决了吗?
预训练模型:ch_PP-OCRv4_det_train

image

@mattheliu
Copy link
Contributor

@564142183 你可以试一下 set: cal_metric_during_train: false

@nikooooooooooooooooooo
Copy link

@mattheliu 感谢大佬回复,把cal_metric_during_train改成false后训练还是报错

[2024-05-11 09:12:21,664] [ WARNING] dataloader_iter.py:707 - DataLoader 1 workers exit unexpectedly, pids: 5673
Traceback (most recent call last):
  File "/PaddleOCR/tools/train.py", line 255, in <module>
    main(config, device, logger, vdl_writer, seed)
  File "/PaddleOCR/tools/train.py", line 208, in main
    program.train(
  File "/PaddleOCR/tools/program.py", line 304, in train
    for idx, batch in enumerate(train_dataloader):
  File "/usr/local/lib/python3.10/dist-packages/paddle/io/dataloader/dataloader_iter.py", line 826, in __next__
    self._reader.read_next_list()[0]
SystemError: (Fatal) Blocking queue is killed because the data reader raises an exception.
  [Hint: Expected killed_ != true, but received killed_:1 == true:1.] (at ../paddle/fluid/operators/reader/blocking_queue.h:171)

@nikooooooooooooooooooo
Copy link

nikooooooooooooooooooo commented May 18, 2024

问题已解决,就是训练完的效果不太理想,附项目地址:https://aistudio.baidu.com/projectdetail/7900653?sUid=3018256&shared=1&ts=1716019542135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR is welcome training this is a training related issue triaged this issue has been looked, and triaged.
Projects
None yet
Development

No branches or pull requests