Repository: mindee/doctr

Issue:
listing the detection and recognition models not working in pytorch
### Bug description

Hi,

This is the list of models not working in inference:

- detection models:
   * db_resnet_34
   * linknet_resnet18
   * linknet_resnet34
   * linknet_resnet50
for all these detection models in pytorch, the code inference works but it get to much segmentations/detected boxes. 


- recognition models:
  * sar_resnet31
  * master
  * vitstr_small
  * vitstr_base
For all of these models in pytorch, the code inference seems to work, but it gets random character recognition. I think they are not  correct loaded or trained.


### Code snippet to reproduce the bug

in doctr/demo/backend/pytorch.py file, changing this lines
```
DET_ARCHS = ["db_resnet50", "db_mobilenet_v3_large", "linknet_resnet50_rotation"]
RECO_ARCHS = ["crnn_vgg16_bn", "crnn_mobilenet_v3_small", "master", "sar_resnet31"]
```

by this lines 
```
#DET_ARCHS = ["db_resnet50", "db_mobilenet_v3_large", "linknet_resnet50_rotation"]
DET_ARCHS = [ "db_resnet34",
        "db_resnet50",
        "db_mobilenet_v3_large",
        "linknet_resnet18",
        "linknet_resnet34",
        "linknet_resnet50",
        "db_resnet50_rotation"]
#RECO_ARCHS = ["crnn_vgg16_bn", "crnn_mobilenet_v3_small", "master", "sar_resnet31"]
RECO_ARCHS=[ "crnn_vgg16_bn",
    "crnn_mobilenet_v3_small",
    "crnn_mobilenet_v3_large",
    "sar_resnet31",
    "master",
    "vitstr_small",
    "vitstr_base"]
```

and running this code to try all the pytorch models
```
USE_TF=0 streamlit run demo/app.py
```


### Error traceback

not errors but bugs on models

### Environment

wget https://raw.githubusercontent.com/mindee/doctr/main/scripts/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

### Deep Learning backend

 from doctr.file_utils import is_tf_available, is_torch_available

print(f"is_tf_available: {is_tf_available()}")
print(f"is_torch_available: {is_torch_available()}")


Discussion:
Hey @nikokks :wave:,

the most of this models does not have pretrained checkpoints but @odulcy-mindee and @charlesmindee are currently on it so stay tuned #969 
Hello @nikokks,
Thanks for this issue! Indeed, we're on it, we'll release model one by one when they'll be trained :+1: 

Resolving patch:
diff --git a/demo/backend/pytorch.py b/demo/backend/pytorch.py
--- a/demo/backend/pytorch.py
+++ b/demo/backend/pytorch.py
@@ -9,8 +9,25 @@
 from doctr.models import ocr_predictor
 from doctr.models.predictor import OCRPredictor
 
-DET_ARCHS = ["db_resnet50", "db_mobilenet_v3_large", "linknet_resnet50_rotation"]
-RECO_ARCHS = ["crnn_vgg16_bn", "crnn_mobilenet_v3_small", "master", "sar_resnet31"]
+DET_ARCHS = [
+    "db_resnet50",
+    "db_resnet34",
+    "db_mobilenet_v3_large",
+    "db_resnet50_rotation",
+    "linknet_resnet18",
+    "linknet_resnet34",
+    "linknet_resnet50",
+]
+RECO_ARCHS = [
+    "crnn_vgg16_bn",
+    "crnn_mobilenet_v3_small",
+    "crnn_mobilenet_v3_large",
+    "master",
+    "sar_resnet31",
+    "vitstr_small",
+    "vitstr_base",
+    "parseq",
+]
 
 
 def load_predictor(det_arch: str, reco_arch: str, device) -> OCRPredictor:
diff --git a/demo/backend/tensorflow.py b/demo/backend/tensorflow.py
--- a/demo/backend/tensorflow.py
+++ b/demo/backend/tensorflow.py
@@ -9,8 +9,24 @@
 from doctr.models import ocr_predictor
 from doctr.models.predictor import OCRPredictor
 
-DET_ARCHS = ["db_resnet50", "db_mobilenet_v3_large", "linknet_resnet18_rotation"]
-RECO_ARCHS = ["crnn_vgg16_bn", "crnn_mobilenet_v3_small", "master", "sar_resnet31"]
+DET_ARCHS = [
+    "db_resnet50",
+    "db_mobilenet_v3_large",
+    "linknet_resnet18",
+    "linknet_resnet18_rotation",
+    "linknet_resnet34",
+    "linknet_resnet50",
+]
+RECO_ARCHS = [
+    "crnn_vgg16_bn",
+    "crnn_mobilenet_v3_small",
+    "crnn_mobilenet_v3_large",
+    "master",
+    "sar_resnet31",
+    "vitstr_small",
+    "vitstr_base",
+    "parseq",
+]
 
 
 def load_predictor(det_arch: str, reco_arch: str, device) -> OCRPredictor:


Test patch: