ArtLabss / tennis-tracking

Open-source Monocular Python HawkEye for Tennis
https://www.artlabs.tech
The Unlicense
392 stars 95 forks source link

`tensorflow.python.framework.errors_impl.InvalidArgumentError` #28

Closed Rudy-by closed 1 year ago

Rudy-by commented 1 year ago

Hello, I have problems when I execute the following command

python3 predict_video.py --input_video_path=VideoInput/video_input3.mp4 --output_video_path=VideoOutput/video_output.mp4 --minimap=0 --bounce=0

Console output:

fps : 30 2023-04-03 08:02:41.981694: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2023-04-03 08:02:41.985775: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcusolver.so.11'; dlerror: libcusolver.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/lg/conda/TensorRT-8.0.1.6/targets/x86_64-linux-gnu/lib:/usr/local/cuda-11.0/lib64: 2023-04-03 08:02:41.986361: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1835] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... 2023-04-03 08:02:41.986675: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. layer24 output shape: 256 360 640 Model: "model_1"


Layer (type) Output Shape Param #

input_1 (InputLayer) [(None, 3, 360, 640)] 0


conv2d (Conv2D) (None, 64, 360, 640) 1792


activation (Activation) (None, 64, 360, 640) 0


batch_normalization (BatchNo (None, 64, 360, 640) 2560


conv2d_1 (Conv2D) (None, 64, 360, 640) 36928


activation_1 (Activation) (None, 64, 360, 640) 0


batch_normalization_1 (Batch (None, 64, 360, 640) 2560


max_pooling2d (MaxPooling2D) (None, 64, 180, 320) 0


conv2d_2 (Conv2D) (None, 128, 180, 320) 73856


activation_2 (Activation) (None, 128, 180, 320) 0


batch_normalization_2 (Batch (None, 128, 180, 320) 1280


conv2d_3 (Conv2D) (None, 128, 180, 320) 147584


activation_3 (Activation) (None, 128, 180, 320) 0


batch_normalization_3 (Batch (None, 128, 180, 320) 1280


max_pooling2d_1 (MaxPooling2 (None, 128, 90, 160) 0


conv2d_4 (Conv2D) (None, 256, 90, 160) 295168


activation_4 (Activation) (None, 256, 90, 160) 0


batch_normalization_4 (Batch (None, 256, 90, 160) 640


conv2d_5 (Conv2D) (None, 256, 90, 160) 590080


activation_5 (Activation) (None, 256, 90, 160) 0


batch_normalization_5 (Batch (None, 256, 90, 160) 640


conv2d_6 (Conv2D) (None, 256, 90, 160) 590080


activation_6 (Activation) (None, 256, 90, 160) 0


batch_normalization_6 (Batch (None, 256, 90, 160) 640


max_pooling2d_2 (MaxPooling2 (None, 256, 45, 80) 0


conv2d_7 (Conv2D) (None, 512, 45, 80) 1180160


activation_7 (Activation) (None, 512, 45, 80) 0


batch_normalization_7 (Batch (None, 512, 45, 80) 320


conv2d_8 (Conv2D) (None, 512, 45, 80) 2359808


activation_8 (Activation) (None, 512, 45, 80) 0


batch_normalization_8 (Batch (None, 512, 45, 80) 320


conv2d_9 (Conv2D) (None, 512, 45, 80) 2359808


activation_9 (Activation) (None, 512, 45, 80) 0


batch_normalization_9 (Batch (None, 512, 45, 80) 320


up_sampling2d (UpSampling2D) (None, 512, 90, 160) 0


conv2d_10 (Conv2D) (None, 256, 90, 160) 1179904


activation_10 (Activation) (None, 256, 90, 160) 0


batch_normalization_10 (Batc (None, 256, 90, 160) 640


conv2d_11 (Conv2D) (None, 256, 90, 160) 590080


activation_11 (Activation) (None, 256, 90, 160) 0


batch_normalization_11 (Batc (None, 256, 90, 160) 640


conv2d_12 (Conv2D) (None, 256, 90, 160) 590080


activation_12 (Activation) (None, 256, 90, 160) 0


batch_normalization_12 (Batc (None, 256, 90, 160) 640


up_sampling2d_1 (UpSampling2 (None, 256, 180, 320) 0


conv2d_13 (Conv2D) (None, 128, 180, 320) 295040


activation_13 (Activation) (None, 128, 180, 320) 0


batch_normalization_13 (Batc (None, 128, 180, 320) 1280


conv2d_14 (Conv2D) (None, 128, 180, 320) 147584


activation_14 (Activation) (None, 128, 180, 320) 0


batch_normalization_14 (Batc (None, 128, 180, 320) 1280


up_sampling2d_2 (UpSampling2 (None, 128, 360, 640) 0


conv2d_15 (Conv2D) (None, 64, 360, 640) 73792


activation_15 (Activation) (None, 64, 360, 640) 0


batch_normalization_15 (Batc (None, 64, 360, 640) 2560


conv2d_16 (Conv2D) (None, 64, 360, 640) 36928


activation_16 (Activation) (None, 64, 360, 640) 0


batch_normalization_16 (Batc (None, 64, 360, 640) 2560


conv2d_17 (Conv2D) (None, 256, 360, 640) 147712


activation_17 (Activation) (None, 256, 360, 640) 0


batch_normalization_17 (Batc (None, 256, 360, 640) 2560


reshape (Reshape) (None, 256, 230400) 0


permute (Permute) (None, 230400, 256) 0


activation_18 (Activation) (None, 230400, 256) 0

Total params: 10,719,104 Trainable params: 10,707,744 Non-trainable params: 11,360


2023-04-03 08:02:42.336100: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open WeightsTracknet/model.1: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v' Using device cuda Detecting the court and the players... /root/miniconda3/envs/test/lib/python3.6/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.) return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) BOXES [array([1014.6489 , 625.9299 , 1083.3445 , 844.51373], dtype=float32)] BIGGEST [1015. 626. 1083. 845.] Finished! Tracking the ball: 0.0 2023-04-03 08:05:12.988603: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2) Traceback (most recent call last): File "predict_video.py", line 155, in pr = m.predict(np.array([X]))[0] File "/root/miniconda3/envs/test/lib/python3.6/site-packages/keras/engine/training.py", line 1751, in predict tmp_batch_outputs = self.predict_function(iterator) File "/root/miniconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 885, in call result = self._call(*args, **kwds) File "/root/miniconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py", line 957, in _call filtered_flat_args, self._concrete_stateful_fn.captured_inputs) # pylint: disable=protected-access File "/root/miniconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 1964, in _call_flat ctx, args, cancellation_manager=cancellation_manager)) File "/root/miniconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/eager/function.py", line 596, in call ctx=ctx) File "/root/miniconda3/envs/test/lib/python3.6/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute inputs, attrs, num_outputs) tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU [[node model_1/max_pooling2d/MaxPool (defined at predict_video.py:155) ]] [Op:__inference_predict_function_1776]

Function call stack: predict_function

requirements.txt has been installed, may I ask what caused it?

shukkkur commented 1 year ago

@lggang119 Hey! I see you closed the issue, does that mean you solved your problem?

Rudy-by commented 1 year ago

I have solved the problem, thank you for your reply.

shukkkur commented 1 year ago

@lggang119 If you could share the solution, perhaps someone might find it helpful in the future 😃

Rudy-by commented 1 year ago

I solve this problem from:

https://stackoverflow.com/questions/58562582/default-maxpoolingop-only-supports-nhwc-on-device-type-cpu

pip install intel-tensorflow. The problem occurs because of the installation of tensorflow