python-doctr 0.8.1__py3-none-any.whl → 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- doctr/__init__.py +1 -1
- doctr/contrib/__init__.py +0 -0
- doctr/contrib/artefacts.py +131 -0
- doctr/contrib/base.py +105 -0
- doctr/datasets/datasets/pytorch.py +2 -2
- doctr/datasets/generator/base.py +6 -5
- doctr/datasets/imgur5k.py +1 -1
- doctr/datasets/loader.py +1 -6
- doctr/datasets/utils.py +2 -1
- doctr/datasets/vocabs.py +9 -2
- doctr/file_utils.py +26 -12
- doctr/io/elements.py +40 -6
- doctr/io/html.py +2 -2
- doctr/io/image/pytorch.py +6 -8
- doctr/io/image/tensorflow.py +1 -1
- doctr/io/pdf.py +5 -2
- doctr/io/reader.py +6 -0
- doctr/models/__init__.py +0 -1
- doctr/models/_utils.py +57 -20
- doctr/models/builder.py +71 -13
- doctr/models/classification/mobilenet/pytorch.py +45 -9
- doctr/models/classification/mobilenet/tensorflow.py +38 -7
- doctr/models/classification/predictor/pytorch.py +18 -11
- doctr/models/classification/predictor/tensorflow.py +16 -10
- doctr/models/classification/textnet/pytorch.py +3 -3
- doctr/models/classification/textnet/tensorflow.py +3 -3
- doctr/models/classification/zoo.py +39 -15
- doctr/models/detection/_utils/__init__.py +1 -0
- doctr/models/detection/_utils/base.py +66 -0
- doctr/models/detection/differentiable_binarization/base.py +4 -3
- doctr/models/detection/differentiable_binarization/pytorch.py +2 -2
- doctr/models/detection/fast/base.py +6 -5
- doctr/models/detection/fast/pytorch.py +4 -4
- doctr/models/detection/fast/tensorflow.py +4 -4
- doctr/models/detection/linknet/base.py +4 -3
- doctr/models/detection/predictor/pytorch.py +15 -1
- doctr/models/detection/predictor/tensorflow.py +15 -1
- doctr/models/detection/zoo.py +7 -2
- doctr/models/factory/hub.py +3 -12
- doctr/models/kie_predictor/base.py +9 -3
- doctr/models/kie_predictor/pytorch.py +41 -20
- doctr/models/kie_predictor/tensorflow.py +36 -16
- doctr/models/modules/layers/pytorch.py +2 -3
- doctr/models/modules/layers/tensorflow.py +6 -8
- doctr/models/modules/transformer/pytorch.py +2 -2
- doctr/models/predictor/base.py +77 -50
- doctr/models/predictor/pytorch.py +31 -20
- doctr/models/predictor/tensorflow.py +27 -17
- doctr/models/preprocessor/pytorch.py +4 -4
- doctr/models/preprocessor/tensorflow.py +3 -2
- doctr/models/recognition/master/pytorch.py +2 -2
- doctr/models/recognition/parseq/pytorch.py +4 -3
- doctr/models/recognition/parseq/tensorflow.py +4 -3
- doctr/models/recognition/sar/pytorch.py +7 -6
- doctr/models/recognition/sar/tensorflow.py +3 -9
- doctr/models/recognition/vitstr/pytorch.py +1 -1
- doctr/models/recognition/zoo.py +1 -1
- doctr/models/zoo.py +2 -2
- doctr/py.typed +0 -0
- doctr/transforms/functional/base.py +1 -1
- doctr/transforms/functional/pytorch.py +4 -4
- doctr/transforms/modules/base.py +37 -15
- doctr/transforms/modules/pytorch.py +66 -8
- doctr/transforms/modules/tensorflow.py +63 -7
- doctr/utils/fonts.py +7 -5
- doctr/utils/geometry.py +35 -12
- doctr/utils/metrics.py +33 -174
- doctr/utils/reconstitution.py +126 -0
- doctr/utils/visualization.py +5 -118
- doctr/version.py +1 -1
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/METADATA +84 -80
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/RECORD +76 -76
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/WHEEL +1 -1
- doctr/models/artefacts/__init__.py +0 -2
- doctr/models/artefacts/barcode.py +0 -74
- doctr/models/artefacts/face.py +0 -63
- doctr/models/obj_detection/__init__.py +0 -1
- doctr/models/obj_detection/faster_rcnn/__init__.py +0 -4
- doctr/models/obj_detection/faster_rcnn/pytorch.py +0 -81
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/LICENSE +0 -0
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/top_level.txt +0 -0
- {python_doctr-0.8.1.dist-info → python_doctr-0.9.0.dist-info}/zip-safe +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
doctr/__init__.py,sha256=
|
|
2
|
-
doctr/file_utils.py,sha256=
|
|
3
|
-
doctr/
|
|
1
|
+
doctr/__init__.py,sha256=q-1tv1hf-BRaZtxsrbPVxYNL6ZtyIOSDvlZOSt85TmU,170
|
|
2
|
+
doctr/file_utils.py,sha256=3LUSkLXfMsxJgLY_Gah9Qlb7-l-Bxx1y6Wm9hlVXJig,3738
|
|
3
|
+
doctr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
doctr/version.py,sha256=BSHwM5KsOpEVgNNeYRIr89q04Tayoadwt508Blp8nAo,23
|
|
5
|
+
doctr/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
doctr/contrib/artefacts.py,sha256=xXkTkZVMrjalzffeBDOXktRhMn-EmUVEdURpDsV0-h8,5351
|
|
7
|
+
doctr/contrib/base.py,sha256=dKUcKvVMyPFvZp_-IekocFNG3JmCJ1cNt0V8BQ5zdV0,3426
|
|
4
8
|
doctr/datasets/__init__.py,sha256=umI2ABbgWIKuhswl8RGaF6CefFiI8DdEGVb0Kbd8aZA,574
|
|
5
9
|
doctr/datasets/cord.py,sha256=p9ObLgqV3uB7TYoS5Puag0q-JtFTPrXUztkxL36U69U,4746
|
|
6
10
|
doctr/datasets/detection.py,sha256=H6inFO6rjdvU_Asm9UTod5r5bjjpmJJWGityv0RTJ8M,3607
|
|
@@ -10,8 +14,8 @@ doctr/datasets/ic03.py,sha256=2HEHvW9tLYFiSEaPeNM4vrqL3ICjth6LUUXPcHjrHjQ,5066
|
|
|
10
14
|
doctr/datasets/ic13.py,sha256=5qjGMmotEOo_8N2gp0XUdZPW5t2gvVe-cTestlfD6Mc,4010
|
|
11
15
|
doctr/datasets/iiit5k.py,sha256=7y4pv4WG-FdXCn7aXLsUodXnk63gRBR8325HfqqlQ3k,3936
|
|
12
16
|
doctr/datasets/iiithws.py,sha256=MFWgIW5bNJSvxWU-USZvbYVHNlkBsnzzMaSGrbut-zQ,2778
|
|
13
|
-
doctr/datasets/imgur5k.py,sha256=
|
|
14
|
-
doctr/datasets/loader.py,sha256=
|
|
17
|
+
doctr/datasets/imgur5k.py,sha256=CeSh2R_U-1iPTg-DZOgY5L6t4F-fX1WkqiMP0C6jivQ,6679
|
|
18
|
+
doctr/datasets/loader.py,sha256=77ErVBRQsXAhe4pTJstZ-wk4wOZSFdw9w-_OMv89IKg,2803
|
|
15
19
|
doctr/datasets/mjsynth.py,sha256=Sybpaxiib8jDOc33OQgl2gGQ4XX8kKsnZaNokKmt08o,4063
|
|
16
20
|
doctr/datasets/ocr.py,sha256=wSAU62NUdFgt52vxo65bXPsuKeVWArlAkD5kxWKypiM,2550
|
|
17
21
|
doctr/datasets/orientation.py,sha256=PZfSQGfBSqzwRlg84L7BA7Lb2jseBvxkKqzh36TtFXk,1113
|
|
@@ -20,51 +24,48 @@ doctr/datasets/sroie.py,sha256=bAkPLmw9aVSu_MyEix_FKFW0pbYye1w16vIkumnQ4E8,3939
|
|
|
20
24
|
doctr/datasets/svhn.py,sha256=Q4M84eRGWLWQ5Bsw0zvouhHTUQl46B9-pS06ZYKT5j8,5251
|
|
21
25
|
doctr/datasets/svt.py,sha256=eos2IUqeM8AW98zJ4PjHQ-hM0hUiJ-cumFhctQrpZp4,4551
|
|
22
26
|
doctr/datasets/synthtext.py,sha256=Q0WKA_UJtgjdBaHHQ888n6ltT-NBuf5kTYQv5SB40IQ,5387
|
|
23
|
-
doctr/datasets/utils.py,sha256=
|
|
24
|
-
doctr/datasets/vocabs.py,sha256=
|
|
27
|
+
doctr/datasets/utils.py,sha256=xdKi9z0hSvW0TOS_Pb_VJabX_pyCgRmMvRxIZBXpjg8,7584
|
|
28
|
+
doctr/datasets/vocabs.py,sha256=TABYcaDr2ZviJJWaH2-DrZTLaQYUVTsUTAGgFia3c4k,3834
|
|
25
29
|
doctr/datasets/wildreceipt.py,sha256=HvnAaxo9lLwC8UMUYYKKJo6HkG8xm2yIHopBsN5G1LA,4566
|
|
26
30
|
doctr/datasets/datasets/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
27
31
|
doctr/datasets/datasets/base.py,sha256=TUK8GMosZnkTBsJm8zOc7AIy3FUMIV2vOTu3YbTjnSQ,4874
|
|
28
|
-
doctr/datasets/datasets/pytorch.py,sha256=
|
|
32
|
+
doctr/datasets/datasets/pytorch.py,sha256=M75erZOBP_Cg05Vk4D01yQZSyyqEbN0omHch1afe4pY,2039
|
|
29
33
|
doctr/datasets/datasets/tensorflow.py,sha256=Ivx_T6o2ttHXjyUy5wi0LpsmKZYOVb7xL1fHKvRlE80,1975
|
|
30
34
|
doctr/datasets/generator/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
31
|
-
doctr/datasets/generator/base.py,sha256=
|
|
35
|
+
doctr/datasets/generator/base.py,sha256=SpzbEqVYUpPZr5NTgccXtpw_yD37WxJ0Jx4HDwa_EKk,5769
|
|
32
36
|
doctr/datasets/generator/pytorch.py,sha256=HUmdHUm7rU84gXv18BeXdYTDBCHabtw21Xdpm-p02ik,2134
|
|
33
37
|
doctr/datasets/generator/tensorflow.py,sha256=Yj9vgEjdNnOwrM4Ew2w5TfkEwNXgy6ACZuEnExZcUMs,2229
|
|
34
38
|
doctr/io/__init__.py,sha256=kS7tKGFvzxOCWBOun-Y8n9CsziwRKNynjwpZEUUI03M,106
|
|
35
|
-
doctr/io/elements.py,sha256=
|
|
36
|
-
doctr/io/html.py,sha256=
|
|
37
|
-
doctr/io/pdf.py,sha256=
|
|
38
|
-
doctr/io/reader.py,sha256=
|
|
39
|
+
doctr/io/elements.py,sha256=bGAIS34Kq_KMGl4zHjIloGCjsbyB6VcrkGq7fvQY71k,24854
|
|
40
|
+
doctr/io/html.py,sha256=cXDCMKztiFafCdPy_AMU5Ven52q1A0FJWXhPnJMLHGg,719
|
|
41
|
+
doctr/io/pdf.py,sha256=V2GAwPFvGAjBqhT85Y6uVejlLy0vn5S94_0ZJVPQLiE,1350
|
|
42
|
+
doctr/io/reader.py,sha256=68pr31K19Tej6UHAqhfAlD11paGX6h3IeSvEje8GaOg,2829
|
|
39
43
|
doctr/io/image/__init__.py,sha256=SqJtZIvr9dIDPLW39kHIX_MxufCKbI54aX28VrjeauE,193
|
|
40
44
|
doctr/io/image/base.py,sha256=g6kdcoIEQVN0dhFsVUA-gwGedhRhyKjFVrPu9QbR_UQ,1740
|
|
41
|
-
doctr/io/image/pytorch.py,sha256=
|
|
42
|
-
doctr/io/image/tensorflow.py,sha256=
|
|
43
|
-
doctr/models/__init__.py,sha256=
|
|
44
|
-
doctr/models/_utils.py,sha256=
|
|
45
|
-
doctr/models/builder.py,sha256=
|
|
45
|
+
doctr/io/image/pytorch.py,sha256=13F8tFXultegdF9yZqCMXSM9Jn4ojwT9YLYWMF5nZ6M,3310
|
|
46
|
+
doctr/io/image/tensorflow.py,sha256=47a-zW4VoAeaoihTsppFJlFyK_8dvGzjGF1GB3Ti0Ig,3213
|
|
47
|
+
doctr/models/__init__.py,sha256=yn_mXUL8B5L27Uaat1rLGRQHgLR8VLVxzBuPfNuN1YE,124
|
|
48
|
+
doctr/models/_utils.py,sha256=zt-wXy0OP8Mw9JhnCLPFhX5d5efdcijgPlLnVKBdRhw,7540
|
|
49
|
+
doctr/models/builder.py,sha256=9b6fCFDJvHo5XOyP8oz6PkrEjyGxyHUecEWYjdHv0IA,20665
|
|
46
50
|
doctr/models/core.py,sha256=SMXYuX1o_Q2zrjcF-vzfqj7IkLKlDyzEOc-4HeiEZ8g,501
|
|
47
|
-
doctr/models/zoo.py,sha256=
|
|
48
|
-
doctr/models/artefacts/__init__.py,sha256=ZPEGVgF1rk1JudUb_9EWijngdQRGsAthWdth28Hjb1U,43
|
|
49
|
-
doctr/models/artefacts/barcode.py,sha256=46QPq7J0i9PG4qtYIsRbGhoJMiNzTht2TCOKDCJiPsU,2721
|
|
50
|
-
doctr/models/artefacts/face.py,sha256=oN2tD6QO7bp79dib9IXK2Y4NB67AIMuoO92n6E1oKqI,1893
|
|
51
|
+
doctr/models/zoo.py,sha256=G52XurwqjVdLRHOZWrEu2QbmZQWsCPdZVIPu874gL_E,9318
|
|
51
52
|
doctr/models/classification/__init__.py,sha256=HeErE29Bs1-91FtS9HqNghHe89XZGzI_11MO_E6GJ7s,154
|
|
52
|
-
doctr/models/classification/zoo.py,sha256=
|
|
53
|
+
doctr/models/classification/zoo.py,sha256=HM2p1fFM83CLqrz7-Vlj-_oBEPNRpuC1bD_0AKquh0E,3503
|
|
53
54
|
doctr/models/classification/magc_resnet/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
54
55
|
doctr/models/classification/magc_resnet/pytorch.py,sha256=UY65c3_Ux2o4hOm_USEQYP7O69bj76qbUB-PCb_0Lng,5603
|
|
55
56
|
doctr/models/classification/magc_resnet/tensorflow.py,sha256=4UDrEcom_2wcyE1QjwmT-u6rtpzQ5ViyB1U6HxpT_XI,6423
|
|
56
57
|
doctr/models/classification/mobilenet/__init__.py,sha256=FBZ2YT2Cq3mj6vpDC3ff5TcMpagNWFhwxQ_brdsgBqo,172
|
|
57
|
-
doctr/models/classification/mobilenet/pytorch.py,sha256=
|
|
58
|
-
doctr/models/classification/mobilenet/tensorflow.py,sha256=
|
|
58
|
+
doctr/models/classification/mobilenet/pytorch.py,sha256=bko2qHGmGfJay2EZmEZlrzgnDah7vhLpibNYIxVFWqo,9318
|
|
59
|
+
doctr/models/classification/mobilenet/tensorflow.py,sha256=VUMq9auHRcDafvjhayCq4fV1fLS14Nxp_O6OEtA7R6A,15601
|
|
59
60
|
doctr/models/classification/predictor/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
60
|
-
doctr/models/classification/predictor/pytorch.py,sha256=
|
|
61
|
-
doctr/models/classification/predictor/tensorflow.py,sha256=
|
|
61
|
+
doctr/models/classification/predictor/pytorch.py,sha256=NEeFSUJ5QhUqtG9pDw5s3ZzR8wSORhicmxESPTVSErw,2288
|
|
62
|
+
doctr/models/classification/predictor/tensorflow.py,sha256=asJl1GiDFq8WJM_J56tx4xPR-Kqrnroc1ZGty5znkDg,2071
|
|
62
63
|
doctr/models/classification/resnet/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
63
64
|
doctr/models/classification/resnet/pytorch.py,sha256=VVkNit3HEezRfOPw8wfuiEEAUCEnYSauCvWaCFF3cwo,12442
|
|
64
65
|
doctr/models/classification/resnet/tensorflow.py,sha256=jBGiL6Mucnq7JGkyIa4Y9A6BQz2ol88cm-eBxJjsTPo,13185
|
|
65
66
|
doctr/models/classification/textnet/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
66
|
-
doctr/models/classification/textnet/pytorch.py,sha256=
|
|
67
|
-
doctr/models/classification/textnet/tensorflow.py,sha256=
|
|
67
|
+
doctr/models/classification/textnet/pytorch.py,sha256=z2BwTM-7ClEzanHWXB5Uie-_X62k1OZZ2Y6m08V_zUM,10163
|
|
68
|
+
doctr/models/classification/textnet/tensorflow.py,sha256=RVg7Nic0cn8A3eswq-YauoqvnDrdxiuzvx_h4qAGubQ,9789
|
|
68
69
|
doctr/models/classification/vgg/__init__.py,sha256=FBZ2YT2Cq3mj6vpDC3ff5TcMpagNWFhwxQ_brdsgBqo,172
|
|
69
70
|
doctr/models/classification/vgg/pytorch.py,sha256=b_q9oWmtlazD4uk9DFYezWgsgAwwN-3ewEz15E2cJR4,3136
|
|
70
71
|
doctr/models/classification/vgg/tensorflow.py,sha256=mVuyIXtX7iu622K0GwXkALOM7gzFtlGX9IABLP2NR2Y,4090
|
|
@@ -73,101 +74,100 @@ doctr/models/classification/vit/pytorch.py,sha256=770ZrCPX7LlVUjE9XNFrzcb2i_0lHS
|
|
|
73
74
|
doctr/models/classification/vit/tensorflow.py,sha256=TtglXtKAE6y_gfzk8DOhUwoQNIMhK86tmhCB1SbT-k0,5869
|
|
74
75
|
doctr/models/detection/__init__.py,sha256=RqSz5beehLiqhW0PwFLFmCfTyMjofO-0umcQJLDMHjY,105
|
|
75
76
|
doctr/models/detection/core.py,sha256=K2uQTIu3ttgxj7YF7i1a-X6djIGCSFjZnQQ57JQBDv0,3566
|
|
76
|
-
doctr/models/detection/zoo.py,sha256=
|
|
77
|
-
doctr/models/detection/_utils/__init__.py,sha256=
|
|
77
|
+
doctr/models/detection/zoo.py,sha256=OJP8K3CKzLRmhaSe0CtvFPioXBcZcvf8__As_6xflFo,3332
|
|
78
|
+
doctr/models/detection/_utils/__init__.py,sha256=6f2JchSfAnB8ZShc4dvR2uZtWXEEIZ22vwt4yENoqXg,151
|
|
79
|
+
doctr/models/detection/_utils/base.py,sha256=56OnQhSmAdG2YRd6D-2tl_YXtZ60OyOyBoyJxuTNZJI,2526
|
|
78
80
|
doctr/models/detection/_utils/pytorch.py,sha256=UZ-PK5Uw0dVN978JGj5MVtF7kLXTL4EtugCoq_VVkVk,1063
|
|
79
81
|
doctr/models/detection/_utils/tensorflow.py,sha256=9D2ita4ZqJus2byLe7bkSIhyYExAiOLAGBbC7-oRZDU,979
|
|
80
82
|
doctr/models/detection/differentiable_binarization/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
81
|
-
doctr/models/detection/differentiable_binarization/base.py,sha256=
|
|
82
|
-
doctr/models/detection/differentiable_binarization/pytorch.py,sha256
|
|
83
|
+
doctr/models/detection/differentiable_binarization/base.py,sha256=fFnXH8iGLXFk4La5G19rqvId_7RDOh5H-v_IRyb1hA0,16432
|
|
84
|
+
doctr/models/detection/differentiable_binarization/pytorch.py,sha256=nYOLVLsLF4zrnXK9u6mTPue7X2JR7WQe2gUb_UMDI6I,15955
|
|
83
85
|
doctr/models/detection/differentiable_binarization/tensorflow.py,sha256=l4QltrgDMLK_eY0dxEaCDzrB8rlhVpwUmOAPNIzd_70,14506
|
|
84
86
|
doctr/models/detection/fast/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
85
|
-
doctr/models/detection/fast/base.py,sha256=
|
|
86
|
-
doctr/models/detection/fast/pytorch.py,sha256=
|
|
87
|
-
doctr/models/detection/fast/tensorflow.py,sha256=
|
|
87
|
+
doctr/models/detection/fast/base.py,sha256=Ydm8fzKwYO_NBMnGazAYg1hpzlXZcRWJ-oKGir36DsE,10927
|
|
88
|
+
doctr/models/detection/fast/pytorch.py,sha256=4FYCaMZ2vzr_j4Phu2bOXs73L_Cfvgu4LDE0Q7m8hz0,16143
|
|
89
|
+
doctr/models/detection/fast/tensorflow.py,sha256=ps0x_AYFW5GYA2SlVQip1S4x61o2mhlSNhhJdaALnF4,15797
|
|
88
90
|
doctr/models/detection/linknet/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
89
|
-
doctr/models/detection/linknet/base.py,sha256=
|
|
91
|
+
doctr/models/detection/linknet/base.py,sha256=R12TMBNeOsY_UTjSFbPr7-FmLsMIJSwxdHc3e3pFLKw,10617
|
|
90
92
|
doctr/models/detection/linknet/pytorch.py,sha256=sodWXaCDv1taRl3g6lgwxitvhU-ZszfN-OIofsorkp8,13810
|
|
91
93
|
doctr/models/detection/linknet/tensorflow.py,sha256=PK3adzBG6wz_SA5lMrh0KBKpbDu-e3FaKwTZ8-ZaN-s,12914
|
|
92
94
|
doctr/models/detection/predictor/__init__.py,sha256=lwmH917kRdbUUBsE02fELIuXQNRNePpIj3iK43ey6Bg,159
|
|
93
|
-
doctr/models/detection/predictor/pytorch.py,sha256=
|
|
94
|
-
doctr/models/detection/predictor/tensorflow.py,sha256=
|
|
95
|
+
doctr/models/detection/predictor/pytorch.py,sha256=sNuMGvcKQeeOcW8QG-xWK0W59DohGYxXlKv0yK2HcNQ,2689
|
|
96
|
+
doctr/models/detection/predictor/tensorflow.py,sha256=W96CJhjYC3-MTcLA3FTH1lLX5DZ3ueYha2b_7A4GxNk,2448
|
|
95
97
|
doctr/models/factory/__init__.py,sha256=cKPoH2V2157lLMTR2zsljG3_IQHziodqR-XK_LG0D_I,19
|
|
96
|
-
doctr/models/factory/hub.py,sha256=
|
|
98
|
+
doctr/models/factory/hub.py,sha256=5IsoyiLfZO_QxM6-dK0-oaAleY8bMvvi9yP_n_W1FHs,7464
|
|
97
99
|
doctr/models/kie_predictor/__init__.py,sha256=lwmH917kRdbUUBsE02fELIuXQNRNePpIj3iK43ey6Bg,159
|
|
98
|
-
doctr/models/kie_predictor/base.py,sha256=
|
|
99
|
-
doctr/models/kie_predictor/pytorch.py,sha256=
|
|
100
|
-
doctr/models/kie_predictor/tensorflow.py,sha256=
|
|
100
|
+
doctr/models/kie_predictor/base.py,sha256=YTGdKda8zqM1H9gB8B2zFEN7C8NjFA00I-o3fRtipvA,2115
|
|
101
|
+
doctr/models/kie_predictor/pytorch.py,sha256=TcWjWb51aoXdfRal4diRbSbJohBOwpKsDUpci6d3VfE,7990
|
|
102
|
+
doctr/models/kie_predictor/tensorflow.py,sha256=MJTP5BlSlG50emhofPPMTKl5MgRdRTGzRhg53tdsMoE,7626
|
|
101
103
|
doctr/models/modules/__init__.py,sha256=pouP7obVTu4p6aHkyaqa1yHKbynpvT0Hgo-LO_1U2R4,83
|
|
102
104
|
doctr/models/modules/layers/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
103
|
-
doctr/models/modules/layers/pytorch.py,sha256=
|
|
104
|
-
doctr/models/modules/layers/tensorflow.py,sha256=
|
|
105
|
+
doctr/models/modules/layers/pytorch.py,sha256=UIidAIKfXQxlX9MbVWADLGrrPE7J496BMfgRHR73jMY,6853
|
|
106
|
+
doctr/models/modules/layers/tensorflow.py,sha256=etXoKXuIeFr_LD-L0x0fhVlL-cUrjL5vFTh4cmci2P8,7145
|
|
105
107
|
doctr/models/modules/transformer/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
106
|
-
doctr/models/modules/transformer/pytorch.py,sha256=
|
|
108
|
+
doctr/models/modules/transformer/pytorch.py,sha256=93wDIrV7odRORV_wOLFNsw-QSH_COjUcp9J55PPp_qA,7664
|
|
107
109
|
doctr/models/modules/transformer/tensorflow.py,sha256=NTF-Q6ClUIMdSWDqus6kPZjOlKC3XcJ3HqUeyZTqtnU,9113
|
|
108
110
|
doctr/models/modules/vision_transformer/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
109
111
|
doctr/models/modules/vision_transformer/pytorch.py,sha256=D6BbqNPV_7OFRogM0iaiWbn_6uLe3Thbo6GKRSYpfTQ,3970
|
|
110
112
|
doctr/models/modules/vision_transformer/tensorflow.py,sha256=PaDbTtCc5YGqZNd_NFMdxeq6oNxs0WtVGYwhLCjJWFY,4199
|
|
111
|
-
doctr/models/obj_detection/__init__.py,sha256=7TJnvLcLYaQtnrXaiBS38qvELgSC-hW6jIhsIfNXob4,27
|
|
112
|
-
doctr/models/obj_detection/faster_rcnn/__init__.py,sha256=LOFUrXC37tQ8hDYF_xTxiD11YEgnLsW2wY0_MJDKszk,144
|
|
113
|
-
doctr/models/obj_detection/faster_rcnn/pytorch.py,sha256=xT1U-Wo0tJLcRXe7QOwoaDDYeJKRqHAM5-TsmSGDJG0,2855
|
|
114
113
|
doctr/models/predictor/__init__.py,sha256=lwmH917kRdbUUBsE02fELIuXQNRNePpIj3iK43ey6Bg,159
|
|
115
|
-
doctr/models/predictor/base.py,sha256=
|
|
116
|
-
doctr/models/predictor/pytorch.py,sha256=
|
|
117
|
-
doctr/models/predictor/tensorflow.py,sha256=
|
|
114
|
+
doctr/models/predictor/base.py,sha256=LY910Umd0u00rrZxQNoPDcizCdsMa2cnDEg6ZQEFFjg,8157
|
|
115
|
+
doctr/models/predictor/pytorch.py,sha256=nc2QJSdUmFLel2x6kTTgRFRNFDXNZnOKwJMSF0WmRWQ,6518
|
|
116
|
+
doctr/models/predictor/tensorflow.py,sha256=Foiji8uEXCLX62E1JWdvlWDX3psLAQtiNd4Fpl0vyuc,6243
|
|
118
117
|
doctr/models/preprocessor/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
119
|
-
doctr/models/preprocessor/pytorch.py,sha256=
|
|
120
|
-
doctr/models/preprocessor/tensorflow.py,sha256=
|
|
118
|
+
doctr/models/preprocessor/pytorch.py,sha256=blJVqP1Xsa5GBX4pWrmaHJetCjP08Im8fry7BzLks-U,4877
|
|
119
|
+
doctr/models/preprocessor/tensorflow.py,sha256=6ZXPxKjXQ8NRTC_FGZZ_6-mEV_5xdzmZhJzdgR2cdl4,4625
|
|
121
120
|
doctr/models/recognition/__init__.py,sha256=902nfVyvjOuUGHDKSGZgoS0fKC52J3jcUJQJhIpvOIY,124
|
|
122
121
|
doctr/models/recognition/core.py,sha256=dbg8SebgfK8CPHXR-7rzmCI9XMLXmWW0jLd1yLLv_34,1593
|
|
123
122
|
doctr/models/recognition/utils.py,sha256=GhNehWmCjl3GJ1ZFneA3cBRrZZk36856uU5i727FaQg,3550
|
|
124
|
-
doctr/models/recognition/zoo.py,sha256=
|
|
123
|
+
doctr/models/recognition/zoo.py,sha256=GFe7TikjfjF5nxuINrFJP7jK3hqan44kjNWoIFyYylA,2506
|
|
125
124
|
doctr/models/recognition/crnn/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
126
125
|
doctr/models/recognition/crnn/pytorch.py,sha256=AE8Ey-Z5VZNGUldL-crbMdyKI__OUMBmn8nYC2790Pc,11802
|
|
127
126
|
doctr/models/recognition/crnn/tensorflow.py,sha256=dcT1X_zLmEqPiWG628lQTe9WMmfEWubXgCWFYs1BhJo,11666
|
|
128
127
|
doctr/models/recognition/master/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
129
128
|
doctr/models/recognition/master/base.py,sha256=5yQ0mUaS_ZWmUUzTAobgAlNS3Vp90PFvrzAcQXUF758,1540
|
|
130
|
-
doctr/models/recognition/master/pytorch.py,sha256
|
|
129
|
+
doctr/models/recognition/master/pytorch.py,sha256=-RpyO6mBW3ql-BjNjnh5T-EMCvxIHLIJSUkB1lzX7Uw,12260
|
|
131
130
|
doctr/models/recognition/master/tensorflow.py,sha256=rbrPMz49ySW8Wpd72dBNOH8dvcoAl3NwBi2ID7qVkxA,12140
|
|
132
131
|
doctr/models/recognition/parseq/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
133
132
|
doctr/models/recognition/parseq/base.py,sha256=8MMqibB8zZLw2qU-iyx79Zpr4MdEtbnF3f3ikfLrBjU,1534
|
|
134
|
-
doctr/models/recognition/parseq/pytorch.py,sha256=
|
|
135
|
-
doctr/models/recognition/parseq/tensorflow.py,sha256=
|
|
133
|
+
doctr/models/recognition/parseq/pytorch.py,sha256=PAojvRwtz1qzKzW3JI_tTm1pco7mPHuX-Y-lah5mZOk,19927
|
|
134
|
+
doctr/models/recognition/parseq/tensorflow.py,sha256=Y0DCm4p2Sjxv8_9zAYP_9rkBQZTMMtlQHoYq4hLk8-0,21632
|
|
136
135
|
doctr/models/recognition/predictor/__init__.py,sha256=lwmH917kRdbUUBsE02fELIuXQNRNePpIj3iK43ey6Bg,159
|
|
137
136
|
doctr/models/recognition/predictor/_utils.py,sha256=y6hDoGS8reluLmx8JmTxM2f1uhlYnjOouh0BOr6wNTA,3389
|
|
138
137
|
doctr/models/recognition/predictor/pytorch.py,sha256=snMHU0GopDEJ9HDdzpVxuvfJxVL-91Le-rc_dSqKCA0,2785
|
|
139
138
|
doctr/models/recognition/predictor/tensorflow.py,sha256=o4Mhbxf9BUofqTV863U7-Zi0H77imX3LfhqzYLc2m4k,2549
|
|
140
139
|
doctr/models/recognition/sar/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
141
|
-
doctr/models/recognition/sar/pytorch.py,sha256=
|
|
142
|
-
doctr/models/recognition/sar/tensorflow.py,sha256=
|
|
140
|
+
doctr/models/recognition/sar/pytorch.py,sha256=pN68aLfuqWKN6dexxeMy3DFJq1YP-MWUsUFj4BBHtXs,15118
|
|
141
|
+
doctr/models/recognition/sar/tensorflow.py,sha256=GLChryUwWZKAc77MxwDwTS8wc9GUzQaxlVv5PpYPuGA,15045
|
|
143
142
|
doctr/models/recognition/vitstr/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
144
143
|
doctr/models/recognition/vitstr/base.py,sha256=Xt7hq45tq999boF0XgW62x_cX5wJXx7VLxWA9H06U_o,1488
|
|
145
|
-
doctr/models/recognition/vitstr/pytorch.py,sha256=
|
|
144
|
+
doctr/models/recognition/vitstr/pytorch.py,sha256=21N7PJbaYmO_mQKW8uS0MGXTtTyFr4QYWRsX6PTKhtU,9568
|
|
146
145
|
doctr/models/recognition/vitstr/tensorflow.py,sha256=_8k6Jxd715uH8lsBqUCn4C_3tlgE75h_BXt4AlfYrk8,9671
|
|
147
146
|
doctr/models/utils/__init__.py,sha256=zwLK6mpproUGFH-1PUNiQyoR9IrAAakj7RgOiTJaBjk,200
|
|
148
147
|
doctr/models/utils/pytorch.py,sha256=bO8a432TzpHTuqAsFuAi2ld6NOT12E2rlghQlW4nAjg,5494
|
|
149
148
|
doctr/models/utils/tensorflow.py,sha256=VccfK6cyPoWuWGWAWbl17MkLa1srtHU-HJCbb_MXePw,6322
|
|
150
149
|
doctr/transforms/__init__.py,sha256=0VHbvUZ7llFd1e_7_JdWTaxYMCvaR6KbUJaYJequmQI,23
|
|
151
150
|
doctr/transforms/functional/__init__.py,sha256=FBZ2YT2Cq3mj6vpDC3ff5TcMpagNWFhwxQ_brdsgBqo,172
|
|
152
|
-
doctr/transforms/functional/base.py,sha256=
|
|
153
|
-
doctr/transforms/functional/pytorch.py,sha256=
|
|
151
|
+
doctr/transforms/functional/base.py,sha256=c2PYwU4ZDDDwTGqgaIdOTP71XZ7lo458yc3CimYxiWQ,6943
|
|
152
|
+
doctr/transforms/functional/pytorch.py,sha256=itjgP7LgIdnPNbIjPqtrZHcxGAlTFg8NP8yBtg9bEco,5007
|
|
154
153
|
doctr/transforms/functional/tensorflow.py,sha256=35dYnCtA9A9SvjndEvckxD8rK_uZ1_4BTgBZ7WiBtGI,9959
|
|
155
154
|
doctr/transforms/modules/__init__.py,sha256=a4GXc5YZWt26eeBKo2HqLmbDn1_qo-uko6GoPNrniC0,221
|
|
156
|
-
doctr/transforms/modules/base.py,sha256=
|
|
157
|
-
doctr/transforms/modules/pytorch.py,sha256=
|
|
158
|
-
doctr/transforms/modules/tensorflow.py,sha256=
|
|
155
|
+
doctr/transforms/modules/base.py,sha256=fwaXQhjuR514-fl4FqVZnb_NsOxkRtE8Yh_hiE2uCTU,9970
|
|
156
|
+
doctr/transforms/modules/pytorch.py,sha256=RCQ1MT9M4bipp5ghIQnxArvg7SjnT7xzHgShtlZmJcA,10937
|
|
157
|
+
doctr/transforms/modules/tensorflow.py,sha256=z1bR_Qk_QKSqeJByKrMTUsJyEekuCjr-ik8NO66nyyo,20348
|
|
159
158
|
doctr/utils/__init__.py,sha256=uQY9ibZ24V896fmihIsK23QOIZdKtk0HyKoCVJ_lLuM,95
|
|
160
159
|
doctr/utils/common_types.py,sha256=KXG-4mvL1MPmkrjuhCs8vAfiaBmdGRmt2yQcNlgALM8,584
|
|
161
160
|
doctr/utils/data.py,sha256=26iN_Ra1OJD_LHIEbefADMxU2yVtCpu3gYdhCW5K9B4,4280
|
|
162
|
-
doctr/utils/fonts.py,sha256=
|
|
163
|
-
doctr/utils/geometry.py,sha256=
|
|
164
|
-
doctr/utils/metrics.py,sha256=
|
|
161
|
+
doctr/utils/fonts.py,sha256=QqtfTDNCEKPb1drUbpXEhVDxtHWhKCKcGHC1l_t2_iI,1336
|
|
162
|
+
doctr/utils/geometry.py,sha256=zMgWMshx5uUqqUPgv8DJGAso96qa7yHu_0UnbzqsGOA,16459
|
|
163
|
+
doctr/utils/metrics.py,sha256=rWZUZGDhIaR422riqH3E5Mhvy_D6QwjKIz55PnILWlI,20552
|
|
165
164
|
doctr/utils/multithreading.py,sha256=iEM6o_qjutH-CxFTz7K1VQseYpVaHH3Hpw_yNDoQBSw,1989
|
|
165
|
+
doctr/utils/reconstitution.py,sha256=O-AaibQRlfhKxCAiqd_lYhXzgoRtFMQgdRwCtuQU1fI,4770
|
|
166
166
|
doctr/utils/repr.py,sha256=3GdMquo1NtwNkQPoB-nmDm_AFmU3sLc4T3VfGck9uoQ,2111
|
|
167
|
-
doctr/utils/visualization.py,sha256=
|
|
168
|
-
python_doctr-0.
|
|
169
|
-
python_doctr-0.
|
|
170
|
-
python_doctr-0.
|
|
171
|
-
python_doctr-0.
|
|
172
|
-
python_doctr-0.
|
|
173
|
-
python_doctr-0.
|
|
167
|
+
doctr/utils/visualization.py,sha256=L6UXyxecH2NVSA_u-OL0_TJ0HGLD5ROAyEaL59I7buI,13277
|
|
168
|
+
python_doctr-0.9.0.dist-info/LICENSE,sha256=75RTSsXOsAYhGpxsHc9U41ep6GS7vrUPufeekgoeOXM,11336
|
|
169
|
+
python_doctr-0.9.0.dist-info/METADATA,sha256=KU5hLGiNSLrBVfS7SBrgNkr4vGIB-OSXaU-nPQf8fRM,33351
|
|
170
|
+
python_doctr-0.9.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
171
|
+
python_doctr-0.9.0.dist-info/top_level.txt,sha256=lCgp4pmjPI3HYph62XhfzA3jRwM715kGtJPmqIUJ9t8,6
|
|
172
|
+
python_doctr-0.9.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
173
|
+
python_doctr-0.9.0.dist-info/RECORD,,
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2021-2024, Mindee.
|
|
2
|
-
|
|
3
|
-
# This program is licensed under the Apache License 2.0.
|
|
4
|
-
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
5
|
-
|
|
6
|
-
from typing import List, Tuple
|
|
7
|
-
|
|
8
|
-
import cv2
|
|
9
|
-
import numpy as np
|
|
10
|
-
|
|
11
|
-
__all__ = ["BarCodeDetector"]
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class BarCodeDetector:
|
|
15
|
-
"""Implements a Bar-code detector.
|
|
16
|
-
For now, only horizontal (or with a small angle) bar-codes are supported
|
|
17
|
-
|
|
18
|
-
Args:
|
|
19
|
-
----
|
|
20
|
-
min_size: minimum relative size of a barcode on the page
|
|
21
|
-
canny_minval: lower bound for canny hysteresis
|
|
22
|
-
canny_maxval: upper-bound for canny hysteresis
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
def __init__(self, min_size: float = 1 / 6, canny_minval: int = 50, canny_maxval: int = 150) -> None:
|
|
26
|
-
self.min_size = min_size
|
|
27
|
-
self.canny_minval = canny_minval
|
|
28
|
-
self.canny_maxval = canny_maxval
|
|
29
|
-
|
|
30
|
-
def __call__(
|
|
31
|
-
self,
|
|
32
|
-
img: np.ndarray,
|
|
33
|
-
) -> List[Tuple[float, float, float, float]]:
|
|
34
|
-
"""Detect Barcodes on the image
|
|
35
|
-
Args:
|
|
36
|
-
img: np image
|
|
37
|
-
|
|
38
|
-
Returns
|
|
39
|
-
-------
|
|
40
|
-
A list of tuples: [(xmin, ymin, xmax, ymax), ...] containing barcodes rel. coordinates
|
|
41
|
-
"""
|
|
42
|
-
# get image size and define parameters
|
|
43
|
-
height, width = img.shape[:2]
|
|
44
|
-
k = (1 + int(width / 512)) * 10 # spatial extension of kernels, 512 -> 20, 1024 -> 30, ...
|
|
45
|
-
min_w = int(width * self.min_size) # minimal size of a possible barcode
|
|
46
|
-
|
|
47
|
-
# Detect edges
|
|
48
|
-
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
49
|
-
edges = cv2.Canny(gray, self.canny_minval, self.canny_maxval, apertureSize=3)
|
|
50
|
-
|
|
51
|
-
# Horizontal dilation to aggregate bars of the potential barcode
|
|
52
|
-
# without aggregating text lines of the page vertically
|
|
53
|
-
edges = cv2.dilate(edges, np.ones((1, k), np.uint8))
|
|
54
|
-
|
|
55
|
-
# Instantiate a barcode-shaped kernel and erode to keep only vertical-bar structures
|
|
56
|
-
bar_code_kernel: np.ndarray = np.zeros((k, 3), np.uint8)
|
|
57
|
-
bar_code_kernel[..., [0, 2]] = 1
|
|
58
|
-
edges = cv2.erode(edges, bar_code_kernel, iterations=1)
|
|
59
|
-
|
|
60
|
-
# Opening to remove noise
|
|
61
|
-
edges = cv2.morphologyEx(edges, cv2.MORPH_OPEN, np.ones((k, k), np.uint8))
|
|
62
|
-
|
|
63
|
-
# Dilation to retrieve vertical length (lost at the first dilation)
|
|
64
|
-
edges = cv2.dilate(edges, np.ones((k, 1), np.uint8))
|
|
65
|
-
|
|
66
|
-
# Find contours, and keep the widest as barcodes
|
|
67
|
-
contours, _ = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
|
68
|
-
barcodes = []
|
|
69
|
-
for contour in contours:
|
|
70
|
-
x, y, w, h = cv2.boundingRect(contour)
|
|
71
|
-
if w >= min_w:
|
|
72
|
-
barcodes.append((x / width, y / height, (x + w) / width, (y + h) / height))
|
|
73
|
-
|
|
74
|
-
return barcodes
|
doctr/models/artefacts/face.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2021-2024, Mindee.
|
|
2
|
-
|
|
3
|
-
# This program is licensed under the Apache License 2.0.
|
|
4
|
-
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
5
|
-
|
|
6
|
-
from typing import List, Tuple
|
|
7
|
-
|
|
8
|
-
import cv2
|
|
9
|
-
import numpy as np
|
|
10
|
-
|
|
11
|
-
from doctr.utils.repr import NestedObject
|
|
12
|
-
|
|
13
|
-
__all__ = ["FaceDetector"]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class FaceDetector(NestedObject):
|
|
17
|
-
"""Implements a face detector to detect profile pictures on resumes, IDS, driving licenses, passports...
|
|
18
|
-
Based on open CV CascadeClassifier (haarcascades)
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
----
|
|
22
|
-
n_faces: maximal number of faces to detect on a single image, default = 1
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
def __init__(
|
|
26
|
-
self,
|
|
27
|
-
n_faces: int = 1,
|
|
28
|
-
) -> None:
|
|
29
|
-
self.n_faces = n_faces
|
|
30
|
-
# Instantiate classifier
|
|
31
|
-
self.detector = cv2.CascadeClassifier(
|
|
32
|
-
cv2.data.haarcascades + "haarcascade_frontalface_default.xml" # type: ignore[attr-defined]
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
def extra_repr(self) -> str:
|
|
36
|
-
return f"n_faces={self.n_faces}"
|
|
37
|
-
|
|
38
|
-
def __call__(
|
|
39
|
-
self,
|
|
40
|
-
img: np.ndarray,
|
|
41
|
-
) -> List[Tuple[float, float, float, float]]:
|
|
42
|
-
"""Detect n_faces on the img
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
----
|
|
46
|
-
img: image to detect faces on
|
|
47
|
-
|
|
48
|
-
Returns:
|
|
49
|
-
-------
|
|
50
|
-
A list of size n_faces, each face is a tuple of relative xmin, ymin, xmax, ymax
|
|
51
|
-
"""
|
|
52
|
-
height, width = img.shape[:2]
|
|
53
|
-
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
54
|
-
|
|
55
|
-
faces = self.detector.detectMultiScale(gray, 1.5, 3)
|
|
56
|
-
# If faces are detected, keep only the biggest ones
|
|
57
|
-
rel_faces = []
|
|
58
|
-
if len(faces) > 0:
|
|
59
|
-
x, y, w, h = sorted(faces, key=lambda x: x[2] + x[3])[-min(self.n_faces, len(faces))]
|
|
60
|
-
xmin, ymin, xmax, ymax = x / width, y / height, (x + w) / width, (y + h) / height
|
|
61
|
-
rel_faces.append((xmin, ymin, xmax, ymax))
|
|
62
|
-
|
|
63
|
-
return rel_faces
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .faster_rcnn import *
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2021-2024, Mindee.
|
|
2
|
-
|
|
3
|
-
# This program is licensed under the Apache License 2.0.
|
|
4
|
-
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
5
|
-
|
|
6
|
-
from typing import Any, Dict
|
|
7
|
-
|
|
8
|
-
from torchvision.models.detection import FasterRCNN, FasterRCNN_MobileNet_V3_Large_FPN_Weights, faster_rcnn
|
|
9
|
-
|
|
10
|
-
from ...utils import load_pretrained_params
|
|
11
|
-
|
|
12
|
-
__all__ = ["fasterrcnn_mobilenet_v3_large_fpn"]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
default_cfgs: Dict[str, Dict[str, Any]] = {
|
|
16
|
-
"fasterrcnn_mobilenet_v3_large_fpn": {
|
|
17
|
-
"input_shape": (3, 1024, 1024),
|
|
18
|
-
"mean": (0.485, 0.456, 0.406),
|
|
19
|
-
"std": (0.229, 0.224, 0.225),
|
|
20
|
-
"classes": ["background", "qr_code", "bar_code", "logo", "photo"],
|
|
21
|
-
"url": "https://doctr-static.mindee.com/models?id=v0.4.1/fasterrcnn_mobilenet_v3_large_fpn-d5b2490d.pt&src=0",
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _fasterrcnn(arch: str, pretrained: bool, **kwargs: Any) -> FasterRCNN:
|
|
27
|
-
_kwargs = {
|
|
28
|
-
"image_mean": default_cfgs[arch]["mean"],
|
|
29
|
-
"image_std": default_cfgs[arch]["std"],
|
|
30
|
-
"box_detections_per_img": 150,
|
|
31
|
-
"box_score_thresh": 0.5,
|
|
32
|
-
"box_positive_fraction": 0.35,
|
|
33
|
-
"box_nms_thresh": 0.2,
|
|
34
|
-
"rpn_nms_thresh": 0.2,
|
|
35
|
-
"num_classes": len(default_cfgs[arch]["classes"]),
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Build the model
|
|
39
|
-
_kwargs.update(kwargs)
|
|
40
|
-
model = faster_rcnn.__dict__[arch](weights=None, weights_backbone=None, **_kwargs)
|
|
41
|
-
model.cfg = default_cfgs[arch]
|
|
42
|
-
|
|
43
|
-
if pretrained:
|
|
44
|
-
# Load pretrained parameters
|
|
45
|
-
load_pretrained_params(model, default_cfgs[arch]["url"])
|
|
46
|
-
else:
|
|
47
|
-
# Filter keys
|
|
48
|
-
state_dict = {
|
|
49
|
-
k: v
|
|
50
|
-
for k, v in faster_rcnn.__dict__[arch](weights=FasterRCNN_MobileNet_V3_Large_FPN_Weights.DEFAULT)
|
|
51
|
-
.state_dict()
|
|
52
|
-
.items()
|
|
53
|
-
if not k.startswith("roi_heads.")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# Load state dict
|
|
57
|
-
model.load_state_dict(state_dict, strict=False)
|
|
58
|
-
|
|
59
|
-
return model
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def fasterrcnn_mobilenet_v3_large_fpn(pretrained: bool = False, **kwargs: Any) -> FasterRCNN:
|
|
63
|
-
"""Faster-RCNN architecture with a MobileNet V3 backbone as described in `"Faster R-CNN: Towards Real-Time
|
|
64
|
-
Object Detection with Region Proposal Networks" <https://arxiv.org/pdf/1506.01497.pdf>`_.
|
|
65
|
-
|
|
66
|
-
>>> import torch
|
|
67
|
-
>>> from doctr.models.obj_detection import fasterrcnn_mobilenet_v3_large_fpn
|
|
68
|
-
>>> model = fasterrcnn_mobilenet_v3_large_fpn(pretrained=True)
|
|
69
|
-
>>> input_tensor = torch.rand((1, 3, 1024, 1024), dtype=torch.float32)
|
|
70
|
-
>>> out = model(input_tensor)
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
----
|
|
74
|
-
pretrained (bool): If True, returns a model pre-trained on our object detection dataset
|
|
75
|
-
**kwargs: keyword arguments of the FasterRCNN architecture
|
|
76
|
-
|
|
77
|
-
Returns:
|
|
78
|
-
-------
|
|
79
|
-
object detection architecture
|
|
80
|
-
"""
|
|
81
|
-
return _fasterrcnn("fasterrcnn_mobilenet_v3_large_fpn", pretrained, **kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|