open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.37k stars 755 forks source link

warnings.warn('Class names are not saved in the checkpoint\'s ') #1383

Closed marouaneamz closed 2 years ago

marouaneamz commented 2 years ago

Scenario

I used the following script to archive the model in .mar to use torchseve:

python tools/deployment/mmcls2torchserve.py \
  ../mdl-py-classification/model/mobile/mobilenet_v2_8xb32_in1k.py \
  ../mdl-py-classification/storage/mobilenet.pth\
  --output-folder ./ \
  --model-name mobilenet

in mobilenet_v2_8xb32_in1k.py i have :

_base_ = [
    '../_base_/models/mobilenet_v2_1x.py',
    '../../datasets/_base_/20220813-19classes.py',
    '../_base_/schedules/imagenet_bs256_epochstep.py',
    '../_base_/default_runtime.py'
]

Actual

normally i added classes to dataset configuration but no results the torchserve does not take into account my class names.

curl http://127.0.0.1:8080/predictions/mobilenet -T ./mdl-py-classification/tmp/cache/20220906-19classes/201810schedulehd-1539076206087-59902-0040_xxx_segments_xxx_finishToReannotate-35-39-frame-2-00000002.png
{
  "pred_label": 3,
  "pred_score": 0.9900903701782227,
  "pred_class": "tiger shark, Galeocerdo cuvieri"
}%                                                   

Expected :

torchseve take into account my class names

xinke-wang commented 2 years ago

Hi, it seems your issue is irrelevant to MMOCR. Please refer to MMClassification.