open-mmlab / mmaction

An open-source toolbox for action understanding based on PyTorch
https://open-mmlab.github.io/
Apache License 2.0
1.86k stars 352 forks source link

how to take inference on multiple threads? #244

Open hamza-projectz opened 1 year ago

hamza-projectz commented 1 year ago

I tried with loading model with multiple objects. The model have been loaded but failed to take inference as given below: Exception in thread Thread-2: Traceback (most recent call last): File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/threading.py", line 870, in run self._target(*self._args, self._kwargs) File "/media/projectz-pc8/Development/Hamza/violation_detection/violation_detection_app/views.py", line 104, in gen_2_with_inference container_2 = violation_detection(frame2, container_2) File "/media/projectz-pc8/Development/Hamza/violation_detection/rtsp_inference.py", line 126, in main detection_class = class_pred(video_full_path, container['model']) File "/media/projectz-pc8/Development/Hamza/violation_detection/video_classification.py", line 34, in main res = mmaction2(call_args) File "/media/projectz-pc8/Development/Hamza/violation_detection/mmaction/apis/inferencers/mmaction2_inferencer.py", line 161, in call preds = self.forward(ori_inputs, batch_size, **forward_kwargs) File "/media/projectz-pc8/Development/Hamza/violation_detection/mmaction/apis/inferencers/mmaction2_inferencer.py", line 93, in forward predictions = self.actionrecog_inferencer( File "/media/projectz-pc8/Development/Hamza/violation_detection/mmaction/apis/inferencers/actionrecog_inferencer.py", line 126, in call return super().call( File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/mmengine/infer/infer.py", line 216, in call for data in track(inputs, description='Inference'): File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/rich/progress.py", line 167, in track with progress: File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/rich/progress.py", line 1169, in enter self.start() File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/rich/progress.py", line 1160, in start self.live.start(refresh=True) File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/rich/live.py", line 113, in start self.console.set_live(self) File "/home/projectz-pc8/anaconda3/envs/orion_tadgan/lib/python3.8/site-packages/rich/console.py", line 835, in set_live raise errors.LiveError("Only one live display may be active at once") rich.errors.LiveError: Only one live display may be active at once