PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.25k stars 7.82k forks source link

训练时候验证集的问题 all input arrays must have the same shape #13916

Closed zengweigit closed 1 month ago

zengweigit commented 1 month ago

🔎 Search before asking

🐛 Bug (问题描述)

我准备了两份数据,第一份就正常,第二份就报形状不一样,我看了半天都看不出我数据哪里形状不一样

第一份: 2024092501/det/val/0045-0_1-339&547_444&583-443&583_339&582_340&547_444&548-0_11_23_28_32_32_26-54-16.jpg [{"transcription": "皖MZ4882", "points": [[339, 546], [444, 546], [444, 582], [339, 582]], "difficult": false}] 2024092501/det/val/0084-1_0-303&359_438&411-437&411_303&408_304&359_438&362-0_0_23_32_24_27_12-52-11.jpg [{"transcription": "皖AZ803N", "points": [[303, 358], [438, 358], [438, 411], [303, 411]], "difficult": false}] 2024092501/det/val/07-0_3-151&459_557&603-557&603_158&599_151&459_550&463-0_0_2_29_25_32_31-107-82.jpg [{"transcription": "皖AC5187", "points": [[149, 459], [559, 459], [559, 602], [149, 602]], "difficult": false}] 2024092501/det/val/028125-90_92-199&486_487&585-485&585_199&582_201&486_487&499-0_0_3_24_33_33_24_24-186-27.jpg [{"transcription": "皖AD09900", "points": [[197, 490], [487, 490], [487, 585], [197, 585]], "difficult": false}] 2024092501/det/val/0275-90_258-203&408_491&504-491&504_218&494_203&412_462&408-0_0_3_24_32_32_25_29-112-45.jpg [{"transcription": "皖AD08815", "points": [[192, 407], [491, 407], [491, 506], [192, 506]], "difficult": false}] 2024092501/det/val/0067-1_1-374&442_499&487-499&484_376&487_374&445_497&442-0_0_32_26_33_16_27-61-11.jpg [{"transcription": "皖A829S3", "points": [[375, 441], [499, 441], [499, 487], [375, 487]], "difficult": false}] 2024092501/det/val/0069-5_2-362&493_475&544-473&544_362&533_364&493_475&504-0_0_32_27_10_33_25-72-55.jpg [{"transcription": "皖A83L91", "points": [[361, 493], [476, 493], [476, 542], [361, 542]], "difficult": false}] 2024092501/det/val/024375-88_260-271&439_559&525-559&525_283&516_271&450_546&439-0_0_3_24_26_29_27_30-142-32.jpg [{"transcription": "皖AD02536", "points": [[280, 442], [563, 442], [563, 526], [280, 526]], "difficult": false}] 2024092501/det/val/0059-1_0-224&472_340&515-340&512_225&515_224&475_339&472-0_0_33_27_32_29_27-50-5.jpg [{"transcription": "皖A93853", "points": [[224, 470], [340, 470], [340, 514], [224, 514]], "difficult": false}] 2024092501/det/val/018125-92_90-208&424_440&503-434&503_208&489_208&424_440&435-0_0_3_24_26_32_24_32-166-93.jpg [{"transcription": "皖AD02808", "points": [[206, 415], [438, 415], [438, 505], [206, 505]], "difficult": false}] 2024092501/det/val/0085-0_1-231&546_365&599-364&599_231&599_232&546_365&546-0_0_12_16_33_26_25-86-26.jpg [{"transcription": "皖ANS921", "points": [[232, 545], [365, 545], [365, 599], [232, 599]], "difficult": false}] 2024092501/det/val/05-11_2-321&382_611&526-597&526_321&469_335&382_611&439-0_0_25_1_30_28_24-79-61.jpg [{"transcription": "皖A1B640", "points": [[321, 384], [619, 384], [619, 531], [321, 531]], "difficult": false}] 2024092501/det/val/0159375-91_90-241&437_457&512-457&512_241&501_241&437_456&442-0_0_3_24_30_31_33_29-108-29.jpg [{"transcription": "皖AD06795", "points": [[235, 435], [462, 435], [462, 505], [235, 505]], "difficult": false}] 2024092501/det/val/02625-88_270-198&430_486&522-483&509_200&522_198&445_486&430-0_0_3_24_30_29_33_32-118-62.jpg [{"transcription": "皖AD06598", "points": [[197, 432], [486, 432], [486, 520], [197, 520]], "difficult": false}] 2024092501/det/val/0081-4_0-317&298_445&351-445&341_321&351_317&308_441&298-0_5_14_27_24_32_33-68-14.jpg [{"transcription": "皖FQ3089", "points": [[317, 297], [446, 297], [446, 352], [317, 352]], "difficult": false}] 2024092501/det/val/015625-90_268-250&425_475&495-473&492_252&495_250&427_475&425-0_0_3_24_29_26_26_32-225-21.jpg [{"transcription": "皖AD05228", "points": [[249, 427], [478, 427], [478, 498], [249, 498]], "difficult": false}] 2024092501/det/val/0050-2_0-323&520_428&560-428&555_325&560_323&525_426&520-0_0_17_6_29_30_32-54-5.jpg [{"transcription": "皖ATG568", "points": [[318, 522], [428, 522], [428, 559], [318, 559]], "difficult": false}] 2024092501/det/val/019375-90_94-263&511_511&589-511&589_263&586_270&511_507&518-0_0_3_24_24_31_25_33-80-220.jpg [{"transcription": "皖AD00719", "points": [[264, 515], [511, 515], [511, 589], [264, 589]], "difficult": false}] 2024092501/det/val/0140625-91_90-250&493_466&559-465&559_250&553_250&493_466&497-0_0_3_26_24_26_29_30-131-69.jpg [{"transcription": "皖AD20256", "points": [[249, 490], [468, 490], [468, 562], [249, 562]], "difficult": false}] 2024092501/det/val/0175-90_90-313&416_537&495-537&489_313&495_313&419_534&416-0_0_3_25_26_24_25_32-104-34.jpg [{"transcription": "皖AD12018", "points": [[312, 417], [539, 417], [539, 498], [312, 498]], "difficult": false}] 2024092501/det/val/015-3_2-220&571_394&643-394&631_222&643_220&583_392&571-0_0_21_25_29_33_32-65-63.jpg [{"transcription": "皖AX1598", "points": [[218, 571], [395, 571], [395, 645], [218, 645]], "difficult": false}] 2024092501/det/val/0153125-90_267-203&486_427&555-426&555_203&554_206&486_427&489-0_0_3_24_24_32_24_32-159-118.jpg [{"transcription": "皖AD00808", "points": [[203, 486], [428, 486], [428, 555], [203, 555]], "difficult": false}] 2024092501/det/val/0125-91_262-154&383_346&448-346&448_160&441_154&383_340&387-0_0_3_24_30_30_33_25-79-39.jpg [{"transcription": "皖AD06691", "points": [[157, 383], [346, 383], [346, 448], [157, 448]], "difficult": false}] 2024092501/det/val/02125-90_267-234&455_506&534-506&532_237&534_234&459_503&455-0_0_3_24_29_27_24_30-88-45.jpg [{"transcription": "皖AD05306", "points": [[231, 453], [507, 453], [507, 534], [231, 534]], "difficult": false}] 2024092501/det/val/065-2_2-190&488_567&632-557&632_190&617_200&488_567&503-0_0_27_25_5_25_25-144-70.jpg [{"transcription": "皖A31F11", "points": [[193, 490], [565, 490], [565, 630], [193, 630]], "difficult": false}] 2024092501/det/val/0171875-92_270-243&436_463&515-459&515_243&515_245&436_463&445-0_0_5_24_24_25_30_30-88-112.jpg [{"transcription": "皖AF00166", "points": [[241, 437], [463, 437], [463, 517], [241, 517]], "difficult": false}] 2024092501/det/val/0054-0_3-328&485_445&524-443&523_328&524_330&486_445&485-0_0_8_31_29_27_26-93-5.jpg [{"transcription": "皖AJ7532", "points": [[327, 483], [445, 483], [445, 525], [327, 525]], "difficult": false}] 2024092501/det/val/0081-3_5-333&460_464&512-464&512_335&505_333&460_462&467-0_0_12_30_25_31_29-42-7.jpg [{"transcription": "皖AN6175", "points": [[332, 459], [462, 459], [462, 513], [332, 513]], "difficult": false}] 2024092501/det/val/0074-9_20-461&540_562&602-553&587_461&602_470&555_562&540-0_0_8_28_25_32_11-95-17.jpg [{"transcription": "皖AJ418M", "points": [[459, 542], [562, 542], [562, 601], [459, 601]], "difficult": false}] 2024092501/det/val/0073-1_2-266&519_396&566-396&563_269&566_266&522_393&519-0_0_4_8_29_29_27-83-30.jpg [{"transcription": "皖AEJ553", "points": [[266, 519], [396, 519], [396, 566], [266, 566]], "difficult": false}] 2024092501/det/val/03125-91_268-146&442_466&540-466&540_146&532_149&442_461&450-0_0_3_24_30_30_33_25-196-117.jpg [{"transcription": "皖AD06691", "points": [[151, 441], [466, 441], [466, 544], [151, 544]], "difficult": false}] 2024092501/det/val/3015-90_264-277&470_493&540-493&540_283&534_277&470_489&472-0_0_3_25_30_30_32_32-99-142.jpg [{"transcription": "皖AD16688", "points": [[271, 469], [493, 469], [493, 538], [271, 538]], "difficult": false}] 2024092501/det/val/0075-0_0-368&450_502&497-502&497_368&497_368&450_502&450-0_0_0_25_30_27_27-79-33.jpg [{"transcription": "皖AA1633", "points": [[366, 448], [503, 448], [503, 499], [366, 499]], "difficult": false}] 2024092501/det/val/013125-91_95-267&447_459&516-459&516_268&509_267&447_455&451-0_0_3_17_25_28_26_31-172-62.jpg [{"transcription": "皖ADT1427", "points": [[266, 448], [460, 448], [460, 514], [266, 514]], "difficult": false}] 2024092501/det/val/02625-88_255-238&436_526&528-526&526_259&528_238&450_511&436-0_0_3_24_27_25_26_32-85-114.jpg [{"transcription": "皖AD03128", "points": [[234, 441], [527, 441], [527, 526], [234, 526]], "difficult": false}] 2024092501/det/val/0079-3_2-217&399_350&449-350&441_218&449_217&407_349&399-0_0_33_4_31_30_26-150-43.jpg [{"transcription": "皖A9E762", "points": [[216, 399], [351, 399], [351, 448], [216, 448]], "difficult": false}] 2024092501/det/val/0085-0_2-337&413_475&465-475&465_339&465_337&413_473&413-0_0_5_6_25_28_25-81-4.jpg [{"transcription": "皖AFG141", "points": [[334, 411], [478, 411], [478, 466], [334, 466]], "difficult": false}] 2024092501/det/val/0083-0_0-255&495_395&545-395&545_255&545_255&495_395&495-0_0_2_8_29_27_26-62-9.jpg [{"transcription": "皖ACJ532", "points": [[251, 492], [398, 492], [398, 548], [251, 548]], "difficult": false}] 2024092501/det/val/0084375-93_97-281&489_443&541-443&541_283&529_281&489_440&490-0_1_5_24_24_33_32_31-104-50.jpg [{"transcription": "皖BF00987", "points": [[283, 486], [444, 486], [444, 540], [283, 540]], "difficult": false}] 2024092501/det/val/0046-0_1-402&426_497&467-497&467_403&467_402&426_496&426-0_15_10_26_26_26_13-129-17.jpg [{"transcription": "皖RL222P", "points": [[401, 426], [498, 426], [498, 467], [401, 467]], "difficult": false}]

第二份: 2024092502/det/val/1219.jpg [{"transcription": "辽GM3271", "points": [[268, 536], [268, 493], [344, 494], [344, 536]], "difficult": false}] 2024092502/det/val/1220.jpg [{"transcription": "黑M08083", "points": [[115, 467], [118, 428], [191, 442], [188, 481]], "difficult": false}] 2024092502/det/val/1221.jpg [{"transcription": "黑D43728", "points": [[258, 533], [258, 495], [389, 496], [389, 534]], "difficult": false}] 2024092502/det/val/1222.jpg [{"transcription": "苏J0X601", "points": [[138, 454], [141, 411], [228, 419], [225, 462]], "difficult": false}] 2024092502/det/val/1223.jpg [{"transcription": "黑M26063", "points": [[167, 350], [168, 329], [238, 331], [237, 352]], "difficult": false}] 2024092502/det/val/1224.jpg [{"transcription": "辽D54176", "points": [[210, 431], [210, 405], [296, 404], [296, 430]], "difficult": false}] 2024092502/det/val/1225.jpg [{"transcription": "鲁UD7118", "points": [[231, 486], [231, 452], [338, 451], [338, 485]], "difficult": false}] 2024092502/det/val/1226.jpg [{"transcription": "鲁YC1075", "points": [[248, 457], [248, 422], [353, 421], [353, 456]], "difficult": false}] 2024092502/det/val/1227.jpg [{"transcription": "吉M87235", "points": [[213, 403], [213, 364], [282, 364], [280, 402]], "difficult": false}] 2024092502/det/val/1228.jpg [{"transcription": "津AK9786", "points": [[216, 463], [215, 433], [308, 430], [309, 461]], "difficult": false}] 2024092502/det/val/1229.jpg [{"transcription": "黑L52370", "points": [[119, 317], [119, 295], [187, 294], [187, 316]], "difficult": false}] 2024092502/det/val/1231.jpg [{"transcription": "冀JD5795", "points": [[263, 363], [263, 334], [351, 333], [352, 361]], "difficult": false}] 2024092502/det/val/1232.jpg [{"transcription": "鲁F33887", "points": [[88, 373], [90, 338], [155, 343], [153, 378]], "difficult": false}] 2024092502/det/val/1233.jpg [{"transcription": "辽AZ2666", "points": [[272, 453], [271, 417], [381, 415], [382, 451]], "difficult": false}] 2024092502/det/val/1234.jpg [{"transcription": "黑L35033", "points": [[153, 484], [155, 441], [278, 443], [277, 486]], "difficult": false}] 2024092502/det/val/1235.jpg [{"transcription": "鲁RE2185", "points": [[224, 493], [224, 459], [334, 458], [335, 492]], "difficult": false}] 2024092502/det/val/1237.jpg [{"transcription": "辽GD2045", "points": [[326, 537], [325, 484], [420, 482], [421, 535]], "difficult": false}] 2024092502/det/val/1238.jpg [{"transcription": "鲁GA5560", "points": [[127, 435], [128, 398], [228, 399], [228, 436]], "difficult": false}] 2024092502/det/val/1239.jpg [{"transcription": "辽GD3421", "points": [[220, 510], [219, 463], [303, 456], [305, 503]], "difficult": false}] 2024092502/det/val/1240.jpg [{"transcription": "蒙G51118", "points": [[266, 495], [266, 447], [355, 446], [356, 495]], "difficult": false}] 2024092502/det/val/1241.jpg [{"transcription": "鲁C28809", "points": [[194, 439], [195, 408], [304, 409], [304, 441]], "difficult": false}] 2024092502/det/val/1243.jpg [{"transcription": "鲁FC6389", "points": [[230, 401], [229, 369], [333, 367], [333, 399]], "difficult": false}] 2024092502/det/val/1244.jpg [{"transcription": "甘J7061", "points": [[229, 408], [229, 370], [296, 369], [296, 407]], "difficult": false}] 2024092502/det/val/1245.jpg [{"transcription": "鲁C31159", "points": [[150, 341], [151, 317], [231, 319], [231, 343]], "difficult": false}] 2024092502/det/val/1246.jpg [{"transcription": "鲁GHB675", "points": [[126, 437], [127, 396], [198, 403], [197, 444]], "difficult": false}] 2024092502/det/val/1247.jpg [{"transcription": "鲁GA5560", "points": [[194, 548], [191, 506], [324, 501], [326, 543]], "difficult": false}] 2024092502/det/val/1248.jpg [{"transcription": "鲁C28331", "points": [[126, 347], [126, 324], [200, 325], [199, 348]], "difficult": false}] 2024092502/det/val/1249.jpg [{"transcription": "豫BHJ678", "points": [[231, 526], [232, 478], [342, 479], [342, 526]], "difficult": false}]

报错信息: image

这到底什么问题啊!!!!! 第二份数据单独一条就能读出来,再加一条就说我形状不一样,到底什么问题???????

🏃‍♂️ Environment (运行环境)

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

zengweigit commented 1 month ago

image

我只留一条就可以正常eval

image

再加一条就报错,报形状不一样

到底什么问题呀,心态爆炸

zengweigit commented 1 month ago

来个官方大神出来解答下,急,急,急......

GreatV commented 1 month ago

用的是什么配置文件,检测、识别还是PGNET

GreatV commented 1 month ago

看一下坐标点数是不是一致,最好能提供一下最小可复现的demo用于复现问题。

zengweigit commented 1 month ago

用的是什么配置文件,检测、识别还是PGNET

检测的

zengweigit commented 1 month ago

看一下坐标点数是不是一致,最好能提供一下最小可复现的demo用于复现问题。

坐标点一致的,

image

我只留一条就可以正常eval

image

再加一条就报错,报形状不一样

到底什么问题呀,心态爆炸

zengweigit commented 1 month ago

用的是什么配置文件,检测、识别还是PGNET

python -m paddle.distributed.launch --gpus 0,1 tools/train.py -c /opt/PaddleOCR/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml -o \ Global.pretrained_model=/opt/PaddleOCR-release-2.7.1/pretrain_models/ch_PP-OCRv3_det_distill_train/student.pdparams \ Global.save_model_dir=/opt/PaddleOCR-release-2.7.1/output/train/det \ Global.epoch_num=5 \ Global.eval_batch_step="[0, 50]" \ Global.save_epoch_step=300 \ Optimizer.lr.name=Const \ Optimizer.lr.learning_rate=0.0005 \ Optimizer.lr.warmup_epoch=0 \ Train.dataset.data_dir=/opt/PaddleOCR-release-2.7.1/train_data \ Train.dataset.label_file_list=[/opt/PaddleOCR-release-2.7.1/train_data/2024092502/det/train.txt] \ Train.dataset.ratio_list="[1.0]" \ Train.loader.batch_size_per_card=16 \ Train.loader.num_workers=8 \ Eval.dataset.data_dir=/opt/PaddleOCR-release-2.7.1/train_data \ Eval.dataset.label_file_list=[/opt/PaddleOCR-release-2.7.1/train_data/2024092502/det/val.txt] \ Eval.loader.batch_size_per_card=4 \ Eval.loader.num_workers=2

zengweigit commented 1 month ago

看一下坐标点数是不是一致,最好能提供一下最小可复现的demo用于复现问题。

开始用的2.8.0版本的,后面又用2.7.0版本,都会出现该问题

zengweigit commented 1 month ago

看一下坐标点数是不是一致,最好能提供一下最小可复现的demo用于复现问题。

能加个微信吗,文件太大这里发不上来

GreatV commented 1 month ago

用一下main分支的试试

GreatV commented 1 month ago

或者2.6.1版本

zengweigit commented 1 month ago

或者2.6.1版本

一样,无奈了。。。。。。

zengweigit commented 1 month ago

image 现在情况就是,1行就可以,2行不行。也不是数据的问题,我删掉第一行的,只保留第二行的也能正常eval。到底啥问题哦

o(╥﹏╥)o

GreatV commented 1 month ago

估计跟shrink_ratio相关

GreatV commented 1 month ago

main分支试试看,不行的话就是bug了

zengweigit commented 1 month ago

main分支试试看,不行的话就是bug了

不行,我把这两行数据加到我可以的val.txt里,也是单独加一行就可以,两行不行。

image

这些版本都试过了 image

这真的看了一天了,都没看出到底哪里形状不一样 o(╥﹏╥)o

image

zengweigit commented 1 month ago

请问能尽快修复吗?我可以提供我的数据集

GreatV commented 1 month ago

官方提供数据集可以跑吗 https://paddlepaddle.github.io/PaddleOCR/datasets/ocr_datasets.html

GreatV commented 1 month ago

你可以数据放到google、百度云盘里,密码通过邮件发我,我复现一下(xinwang614@gmail.com)。paddleocr现在是社区维护,没法保证修复速度效率。

zengweigit commented 1 month ago

官方提供数据集可以跑吗 https://paddlepaddle.github.io/PaddleOCR/datasets/ocr_datasets.html

官方的可以

zengweigit commented 1 month ago

你可以数据放到google、百度云盘里,密码通过邮件发我,我复现一下(xinwang614@gmail.com)。paddleocr现在是社区维护,没法保证修复速度效率。

image 发你邮箱了,数据集在附件里

GreatV commented 1 month ago

OK,我晚上看一下。

zengweigit commented 1 month ago

识别的模型就不会,都是同一份标注里导出来的,神奇。有劳晚上看下检测的eval问题 image

GreatV commented 1 month ago

把这里设置成1就行了

Eval.loader.batch_size_per_card=1

详细解释见: https://paddlepaddle.github.io/PaddleOCR/FAQ.html?h=1+batch+size+per+card#qpaddleocrtest_batch_size_per_card1

zengweigit commented 1 month ago

把这里设置成1就行了

Eval.loader.batch_size_per_card=1

详细解释见: https://paddlepaddle.github.io/PaddleOCR/FAQ.html?h=1+batch+size+per+card#qpaddleocrtest_batch_size_per_card1

好的,感谢解惑