question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'DataContainer' object is not subscriptable during TensorRT

See original GitHub issue

Hello,

Im trying to convert CRNN text recognition model to TensorRT backbone but getting an error. I was able to convert the pytorch model to TensorRT without any issue and also i was able to measure the performance without error. However, when I try to evaluate the model Im facing the following error. Any idea how can I solve the issue??

2022-01-25 11:29:44,658 - mmdeploy - INFO - Sorting the dataset by 'height' and 'width' is not possible.
2022-01-25 11:29:44,783 - mmdeploy - INFO - Successfully loaded tensorrt plugins from /home/Documents/Dev/MMDeploy/build/lib/libmmdeploy_tensorrt_ops.so
2022-01-25 11:29:44,783 - mmdeploy - INFO - Successfully loaded tensorrt plugins from /home/Documents/Dev/MMDeploy/build/lib/libmmdeploy_tensorrt_ops.so
[01/25/2022-11:29:45] [TRT] [W] TensorRT was linked against cuBLAS/cuBLAS LT 11.6.3 but loaded cuBLAS/cuBLAS LT 11.5.1
[01/25/2022-11:29:46] [TRT] [W] TensorRT was linked against cuBLAS/cuBLAS LT 11.6.3 but loaded cuBLAS/cuBLAS LT 11.5.1
[                                                  ] 0/7672, elapsed: 0s, ETA:Traceback (most recent call last):
  File "./tools/test.py", line 140, in <module>
    main()
  File "./tools/test.py", line 133, in main
    args.show_dir)
  File "/home/Documents/Dev/MMDeploy/mmdeploy/codebase/base/task.py", line 138, in single_gpu_test
    out_dir, **kwargs)
  File "/home/Documents/Dev/MMDeploy/mmdeploy/codebase/mmocr/deploy/mmocr.py", line 141, in single_gpu_test
    outputs = single_gpu_test(model, data_loader, show, out_dir, **kwargs)
  File "/home/anaconda3/envs/mmdeploy/lib/python3.7/site-packages/mmdet/apis/test.py", line 32, in single_gpu_test
    if batch_size == 1 and isinstance(data['img'][0], torch.Tensor):
TypeError: 'DataContainer' object is not subscriptable

This is the command I use to evaluate the performance

DEPLOY_CFG="configs/mmocr/text-recognition/text-recognition_tensorrt-fp16_dynamic-1x32x32-1x32x640.py"
MODEL_CFG="/home/Documents/Dev/mmocr/configs/textrecog/crnn/crnn_academic_dataset.py"

python ./tools/test.py ${DEPLOY_CFG} ${MODEL_CFG} --model "/home/Desktop/ocr-tensorRT/end2end.engine" --out /home/Desktop/ocr-tensorRT/out/out_ocr.pkl --show-dir "/home/Desktop/ocr-tensorRT"

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Harold-lkkcommented, Jan 27, 2022

@RunningLeon, The command I mentioned works without show-dir however when I specify the --show or --show-dir I get the error I meantioned.

mmocr = '0.4.0'
mmcv = '1.4.4'
mmdeploy = '0.1.0'

MMOCR has fixed this issue in mmocr = ‘0.4.1’, more detail can be found in https://github.com/open-mmlab/mmocr/releases/tag/v0.4.1. You can install the latest mmocr.

0reactions
RunningLeoncommented, Jan 28, 2022

Feel free to reopen if still have same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object is not subscriptable in python - Stack Overflow
This should work: cpulimit = int((containers[0].resources.limits['cpu']).split("m")[0]). Since you are using containers instead of container ...
Read more >
TensorRT Release 22.07 - NVIDIA Documentation Center
Some samples require data files that are not included in the TensorRT container because of licensing restrictions, or because they are too ...
Read more >
tf.distribute.DistributedIterator | TensorFlow v2.11.0
An tf.experimental.Optional object representing the next value from the tf.distribute.DistributedIterator (if it has one) or no value.
Read more >
Archive a blob
az storage blob upload-batch \ --destination <container> \ --source ... stack. var uris = new Stack<Uri>(); await foreach (var item in blobContainerClient.
Read more >
[Example code]-Find the canonical link in a FILE type file
(Errors: NoneType object is not subscriptable/NoneType object doesn't have attribute href). I manually checked my file by opening it in Notepad and I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found