smellslikeml / ActionAI

Real-Time Spatio-Temporally Localized Activity Detection by Tracking Body Keypoints
https://www.hackster.io/actionai/actionai-custom-tracking-multiperson-activity-recognition-fa5cb5
GNU General Public License v3.0
772 stars 192 forks source link

Jetson Nano: AttributeError: 'NoneType' object has no attribute 'create_execution_context #46

Open lesreaper opened 3 years ago

lesreaper commented 3 years ago

System

Library Version
Jetson Nano on Jetpack 4.5.1
CUDA 10.2
TensorRT 7.1.3
PyTorch 1.8
TorchVision 0.9.0
Tensorflow 2.4.0

Verified USB Webcam is working with OpenCV and Tensorflow TRT Yolo model in same virtual environment.

Installed system requirements, installed trt_pose repo, downloaded model assets to the /models directory, and getting this error when running: python iva.py 0

optimized model path: /home/nvidia/ActionAI/models/resnet18_baseline_att_224x224_A_epoch_249_trt.pth
[TensorRT] ERROR: coreReadArchive.cpp (31) - Serialization Error in verifyHeader: 0 (Magic tag does not match)
[TensorRT] ERROR: INVALID_STATE: std::exception
[TensorRT] ERROR: INVALID_CONFIG: Deserialize the cuda engine failed.
Traceback (most recent call last):
  File "iva.py", line 42, in <module>
    model_trt.load_state_dict(torch.load(OPTIMIZED_MODEL))
  File "/home/nvidia/.virtualenvs/py3tf23cv4/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1209, in load_state_dict
    load(self)
  File "/home/nvidia/.virtualenvs/py3tf23cv4/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1204, in load
    state_dict, prefix, local_metadata, True, missing_keys, unexpected_keys, error_msgs)
  File "/home/nvidia/.virtualenvs/py3tf23cv4/lib/python3.6/site-packages/torch2trt-0.2.0-py3.6-linux-aarch64.egg/torch2trt/torch2trt.py", line 454, in _load_from_state_dict
    self.context = self.engine.create_execution_context()
AttributeError: 'NoneType' object has no attribute 'create_execution_context'

There is an article on nVIdia which says this could be to mismatching input sizes, though I don't see how that could be. The other thing is it could be a TensorRT incompatibility.

Has anyone been able to get this running on a Jetson Nano with the Jetpack 4.5? Any ideas out there?

alice929 commented 2 years ago

Have you solved the above problem?