theAIGuysCode / yolov4-deepsort

Object tracking implemented with YOLOv4, DeepSort, and TensorFlow.
GNU General Public License v3.0
1.31k stars 745 forks source link

Unable to run YOLOv4 or YOLOv4-tiny with batch size > 1 #136

Closed jnissin closed 2 years ago

jnissin commented 2 years ago

Hey,

I have been successfully using the YOLOv4 and YOLOv4-tiny for inference with batch size 1 with an input tensor shape of [1, 416, 416, 3], however, if I try to run the model with batch size > 1, I always encounter the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError:  Input to reshape is a tensor with 4 values, but the requested shape requires a multiple of 8
         [[node functional_1/tf_op_layer_Reshape_10/Reshape_10 (defined at object_tracker.py:136) ]] [Op:__inference_predict_function_17447]

This was received using batch size of 2 resulting in input tensor shape of [2, 416, 416, 3], can anyone point me in a right direction with respect to what I am doing wrong or is the model even supposed to work when attempting to run inference with batch size above one?

Here is some of the code I am using for model loading and inference:

model = tf.saved_model.load(self.model_weights_path, tags=[tag_constants.SERVING])
inference_function = model.signatures["serving_default"]
tf_batch_data = tf.constant(np.array(image_batch_data))
print(f"Image batch data: {tf.shape(tf_batch_data)}")
tf_pred_bbox = inference_function(tf_batch_data)

Is there possibly something that I need to change e.g. under core/config.py to make the model work with different batch sizes? I am confused because the input layer according to keras model summary seems to have the batch dimension defined as None which would indicate that the model supports variable batch sizes:

>>> model.summary()
Model: "functional_1"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_1 (InputLayer)            [(None, 416, 416, 3) 0                                            
__________________________________________________________________________________________________
zero_padding2d (ZeroPadding2D)  (None, 417, 417, 3)  0           input_1[0][0]                    
__________________________________________________________________________________________________
conv2d (Conv2D)                 (None, 208, 208, 32) 864         zero_padding2d[0][0]             
__________________________________________________________________________________________________
batch_normalization (BatchNorma (None, 208, 208, 32) 128         conv2d[0][0]                     
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu (TensorFl (None, 208, 208, 32) 0           batch_normalization[0][0]        
__________________________________________________________________________________________________
zero_padding2d_1 (ZeroPadding2D (None, 209, 209, 32) 0           tf_op_layer_LeakyRelu[0][0]      
__________________________________________________________________________________________________
conv2d_1 (Conv2D)               (None, 104, 104, 64) 18432       zero_padding2d_1[0][0]           
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, 104, 104, 64) 256         conv2d_1[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_1 (Tensor (None, 104, 104, 64) 0           batch_normalization_1[0][0]      
__________________________________________________________________________________________________
conv2d_2 (Conv2D)               (None, 104, 104, 64) 36864       tf_op_layer_LeakyRelu_1[0][0]    
__________________________________________________________________________________________________
batch_normalization_2 (BatchNor (None, 104, 104, 64) 256         conv2d_2[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_2 (Tensor (None, 104, 104, 64) 0           batch_normalization_2[0][0]      
__________________________________________________________________________________________________
tf_op_layer_split (TensorFlowOp [(None, 104, 104, 32 0           tf_op_layer_LeakyRelu_2[0][0]    
__________________________________________________________________________________________________
conv2d_3 (Conv2D)               (None, 104, 104, 32) 9216        tf_op_layer_split[0][1]          
__________________________________________________________________________________________________
batch_normalization_3 (BatchNor (None, 104, 104, 32) 128         conv2d_3[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_3 (Tensor (None, 104, 104, 32) 0           batch_normalization_3[0][0]      
__________________________________________________________________________________________________
conv2d_4 (Conv2D)               (None, 104, 104, 32) 9216        tf_op_layer_LeakyRelu_3[0][0]    
__________________________________________________________________________________________________
batch_normalization_4 (BatchNor (None, 104, 104, 32) 128         conv2d_4[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_4 (Tensor (None, 104, 104, 32) 0           batch_normalization_4[0][0]      
__________________________________________________________________________________________________
tf_op_layer_concat (TensorFlowO (None, 104, 104, 64) 0           tf_op_layer_LeakyRelu_4[0][0]    
                                                                 tf_op_layer_LeakyRelu_3[0][0]    
__________________________________________________________________________________________________
conv2d_5 (Conv2D)               (None, 104, 104, 64) 4096        tf_op_layer_concat[0][0]         
__________________________________________________________________________________________________
batch_normalization_5 (BatchNor (None, 104, 104, 64) 256         conv2d_5[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_5 (Tensor (None, 104, 104, 64) 0           batch_normalization_5[0][0]      
__________________________________________________________________________________________________
tf_op_layer_concat_1 (TensorFlo (None, 104, 104, 128 0           tf_op_layer_LeakyRelu_2[0][0]    
                                                                 tf_op_layer_LeakyRelu_5[0][0]    
__________________________________________________________________________________________________
max_pooling2d (MaxPooling2D)    (None, 52, 52, 128)  0           tf_op_layer_concat_1[0][0]       
__________________________________________________________________________________________________
conv2d_6 (Conv2D)               (None, 52, 52, 128)  147456      max_pooling2d[0][0]              
__________________________________________________________________________________________________
batch_normalization_6 (BatchNor (None, 52, 52, 128)  512         conv2d_6[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_6 (Tensor (None, 52, 52, 128)  0           batch_normalization_6[0][0]      
__________________________________________________________________________________________________
tf_op_layer_split_1 (TensorFlow [(None, 52, 52, 64), 0           tf_op_layer_LeakyRelu_6[0][0]    
__________________________________________________________________________________________________
conv2d_7 (Conv2D)               (None, 52, 52, 64)   36864       tf_op_layer_split_1[0][1]        
__________________________________________________________________________________________________
batch_normalization_7 (BatchNor (None, 52, 52, 64)   256         conv2d_7[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_7 (Tensor (None, 52, 52, 64)   0           batch_normalization_7[0][0]      
__________________________________________________________________________________________________
conv2d_8 (Conv2D)               (None, 52, 52, 64)   36864       tf_op_layer_LeakyRelu_7[0][0]    
__________________________________________________________________________________________________
batch_normalization_8 (BatchNor (None, 52, 52, 64)   256         conv2d_8[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_8 (Tensor (None, 52, 52, 64)   0           batch_normalization_8[0][0]      
__________________________________________________________________________________________________
tf_op_layer_concat_2 (TensorFlo (None, 52, 52, 128)  0           tf_op_layer_LeakyRelu_8[0][0]    
                                                                 tf_op_layer_LeakyRelu_7[0][0]    
__________________________________________________________________________________________________
conv2d_9 (Conv2D)               (None, 52, 52, 128)  16384       tf_op_layer_concat_2[0][0]       
__________________________________________________________________________________________________
batch_normalization_9 (BatchNor (None, 52, 52, 128)  512         conv2d_9[0][0]                   
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_9 (Tensor (None, 52, 52, 128)  0           batch_normalization_9[0][0]      
__________________________________________________________________________________________________
tf_op_layer_concat_3 (TensorFlo (None, 52, 52, 256)  0           tf_op_layer_LeakyRelu_6[0][0]    
                                                                 tf_op_layer_LeakyRelu_9[0][0]    
__________________________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D)  (None, 26, 26, 256)  0           tf_op_layer_concat_3[0][0]       
__________________________________________________________________________________________________
conv2d_10 (Conv2D)              (None, 26, 26, 256)  589824      max_pooling2d_1[0][0]            
__________________________________________________________________________________________________
batch_normalization_10 (BatchNo (None, 26, 26, 256)  1024        conv2d_10[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_10 (Tenso (None, 26, 26, 256)  0           batch_normalization_10[0][0]     
__________________________________________________________________________________________________
tf_op_layer_split_2 (TensorFlow [(None, 26, 26, 128) 0           tf_op_layer_LeakyRelu_10[0][0]   
__________________________________________________________________________________________________
conv2d_11 (Conv2D)              (None, 26, 26, 128)  147456      tf_op_layer_split_2[0][1]        
__________________________________________________________________________________________________
batch_normalization_11 (BatchNo (None, 26, 26, 128)  512         conv2d_11[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_11 (Tenso (None, 26, 26, 128)  0           batch_normalization_11[0][0]     
__________________________________________________________________________________________________
conv2d_12 (Conv2D)              (None, 26, 26, 128)  147456      tf_op_layer_LeakyRelu_11[0][0]   
__________________________________________________________________________________________________
batch_normalization_12 (BatchNo (None, 26, 26, 128)  512         conv2d_12[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_12 (Tenso (None, 26, 26, 128)  0           batch_normalization_12[0][0]     
__________________________________________________________________________________________________
tf_op_layer_concat_4 (TensorFlo (None, 26, 26, 256)  0           tf_op_layer_LeakyRelu_12[0][0]   
                                                                 tf_op_layer_LeakyRelu_11[0][0]   
__________________________________________________________________________________________________
conv2d_13 (Conv2D)              (None, 26, 26, 256)  65536       tf_op_layer_concat_4[0][0]       
__________________________________________________________________________________________________
batch_normalization_13 (BatchNo (None, 26, 26, 256)  1024        conv2d_13[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_13 (Tenso (None, 26, 26, 256)  0           batch_normalization_13[0][0]     
__________________________________________________________________________________________________
tf_op_layer_concat_5 (TensorFlo (None, 26, 26, 512)  0           tf_op_layer_LeakyRelu_10[0][0]   
                                                                 tf_op_layer_LeakyRelu_13[0][0]   
__________________________________________________________________________________________________
max_pooling2d_2 (MaxPooling2D)  (None, 13, 13, 512)  0           tf_op_layer_concat_5[0][0]       
__________________________________________________________________________________________________
conv2d_14 (Conv2D)              (None, 13, 13, 512)  2359296     max_pooling2d_2[0][0]            
__________________________________________________________________________________________________
batch_normalization_14 (BatchNo (None, 13, 13, 512)  2048        conv2d_14[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_14 (Tenso (None, 13, 13, 512)  0           batch_normalization_14[0][0]     
__________________________________________________________________________________________________
conv2d_15 (Conv2D)              (None, 13, 13, 256)  131072      tf_op_layer_LeakyRelu_14[0][0]   
__________________________________________________________________________________________________
batch_normalization_15 (BatchNo (None, 13, 13, 256)  1024        conv2d_15[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_15 (Tenso (None, 13, 13, 256)  0           batch_normalization_15[0][0]     
__________________________________________________________________________________________________
conv2d_18 (Conv2D)              (None, 13, 13, 128)  32768       tf_op_layer_LeakyRelu_15[0][0]   
__________________________________________________________________________________________________
batch_normalization_17 (BatchNo (None, 13, 13, 128)  512         conv2d_18[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_17 (Tenso (None, 13, 13, 128)  0           batch_normalization_17[0][0]     
__________________________________________________________________________________________________
tf_op_layer_ResizeBilinear (Ten (None, 26, 26, 128)  0           tf_op_layer_LeakyRelu_17[0][0]   
__________________________________________________________________________________________________
tf_op_layer_concat_6 (TensorFlo (None, 26, 26, 384)  0           tf_op_layer_ResizeBilinear[0][0] 
                                                                 tf_op_layer_LeakyRelu_13[0][0]   
__________________________________________________________________________________________________
conv2d_19 (Conv2D)              (None, 26, 26, 256)  884736      tf_op_layer_concat_6[0][0]       
__________________________________________________________________________________________________
conv2d_16 (Conv2D)              (None, 13, 13, 512)  1179648     tf_op_layer_LeakyRelu_15[0][0]   
__________________________________________________________________________________________________
batch_normalization_18 (BatchNo (None, 26, 26, 256)  1024        conv2d_19[0][0]                  
__________________________________________________________________________________________________
batch_normalization_16 (BatchNo (None, 13, 13, 512)  2048        conv2d_16[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_18 (Tenso (None, 26, 26, 256)  0           batch_normalization_18[0][0]     
__________________________________________________________________________________________________
tf_op_layer_LeakyRelu_16 (Tenso (None, 13, 13, 512)  0           batch_normalization_16[0][0]     
__________________________________________________________________________________________________
conv2d_20 (Conv2D)              (None, 26, 26, 255)  65535       tf_op_layer_LeakyRelu_18[0][0]   
__________________________________________________________________________________________________
conv2d_17 (Conv2D)              (None, 13, 13, 255)  130815      tf_op_layer_LeakyRelu_16[0][0]   
__________________________________________________________________________________________________
tf_op_layer_Shape (TensorFlowOp (4,)                 0           conv2d_20[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_Shape_1 (TensorFlow (4,)                 0           conv2d_17[0][0]                  
__________________________________________________________________________________________________
tf_op_layer_strided_slice (Tens ()                   0           tf_op_layer_Shape[0][0]          
__________________________________________________________________________________________________
tf_op_layer_strided_slice_1 (Te ()                   0           tf_op_layer_Shape_1[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Reshape/shape (Tens (5,)                 0           tf_op_layer_strided_slice[0][0]  
__________________________________________________________________________________________________
tf_op_layer_Reshape_3/shape (Te (5,)                 0           tf_op_layer_strided_slice_1[0][0]
__________________________________________________________________________________________________
tf_op_layer_Reshape (TensorFlow (None, 26, 26, 3, 85 0           conv2d_20[0][0]                  
                                                                 tf_op_layer_Reshape/shape[0][0]  
__________________________________________________________________________________________________
tf_op_layer_Reshape_3 (TensorFl (None, 13, 13, 3, 85 0           conv2d_17[0][0]                  
                                                                 tf_op_layer_Reshape_3/shape[0][0]
__________________________________________________________________________________________________
tf_op_layer_split_3 (TensorFlow [(None, 26, 26, 3, 2 0           tf_op_layer_Reshape[0][0]        
__________________________________________________________________________________________________
tf_op_layer_split_4 (TensorFlow [(None, 13, 13, 3, 2 0           tf_op_layer_Reshape_3[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Sigmoid (TensorFlow (None, 26, 26, 3, 2) 0           tf_op_layer_split_3[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Tile/multiples (Ten (5,)                 0           tf_op_layer_strided_slice[0][0]  
__________________________________________________________________________________________________
tf_op_layer_Sigmoid_3 (TensorFl (None, 13, 13, 3, 2) 0           tf_op_layer_split_4[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Tile_1/multiples (T (5,)                 0           tf_op_layer_strided_slice_1[0][0]
__________________________________________________________________________________________________
tf_op_layer_Mul (TensorFlowOpLa (None, 26, 26, 3, 2) 0           tf_op_layer_Sigmoid[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Tile (TensorFlowOpL (None, 26, 26, 3, 2) 0           tf_op_layer_Tile/multiples[0][0] 
__________________________________________________________________________________________________
tf_op_layer_Mul_4 (TensorFlowOp (None, 13, 13, 3, 2) 0           tf_op_layer_Sigmoid_3[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Tile_1 (TensorFlowO (None, 13, 13, 3, 2) 0           tf_op_layer_Tile_1/multiples[0][0
__________________________________________________________________________________________________
tf_op_layer_Sub (TensorFlowOpLa (None, 26, 26, 3, 2) 0           tf_op_layer_Mul[0][0]            
__________________________________________________________________________________________________
tf_op_layer_Cast (TensorFlowOpL (None, 26, 26, 3, 2) 0           tf_op_layer_Tile[0][0]           
__________________________________________________________________________________________________
tf_op_layer_Sub_1 (TensorFlowOp (None, 13, 13, 3, 2) 0           tf_op_layer_Mul_4[0][0]          
__________________________________________________________________________________________________
tf_op_layer_Cast_1 (TensorFlowO (None, 13, 13, 3, 2) 0           tf_op_layer_Tile_1[0][0]         
__________________________________________________________________________________________________
tf_op_layer_AddV2 (TensorFlowOp (None, 26, 26, 3, 2) 0           tf_op_layer_Sub[0][0]            
                                                                 tf_op_layer_Cast[0][0]           
__________________________________________________________________________________________________
tf_op_layer_Exp (TensorFlowOpLa (None, 26, 26, 3, 2) 0           tf_op_layer_split_3[0][1]        
__________________________________________________________________________________________________
tf_op_layer_AddV2_1 (TensorFlow (None, 13, 13, 3, 2) 0           tf_op_layer_Sub_1[0][0]          
                                                                 tf_op_layer_Cast_1[0][0]         
__________________________________________________________________________________________________
tf_op_layer_Exp_1 (TensorFlowOp (None, 13, 13, 3, 2) 0           tf_op_layer_split_4[0][1]        
__________________________________________________________________________________________________
tf_op_layer_Mul_1 (TensorFlowOp (None, 26, 26, 3, 2) 0           tf_op_layer_AddV2[0][0]          
__________________________________________________________________________________________________
tf_op_layer_Mul_2 (TensorFlowOp (None, 26, 26, 3, 2) 0           tf_op_layer_Exp[0][0]            
__________________________________________________________________________________________________
tf_op_layer_Mul_5 (TensorFlowOp (None, 13, 13, 3, 2) 0           tf_op_layer_AddV2_1[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Mul_6 (TensorFlowOp (None, 13, 13, 3, 2) 0           tf_op_layer_Exp_1[0][0]          
__________________________________________________________________________________________________
tf_op_layer_concat_7 (TensorFlo (None, 26, 26, 3, 4) 0           tf_op_layer_Mul_1[0][0]          
                                                                 tf_op_layer_Mul_2[0][0]          
__________________________________________________________________________________________________
tf_op_layer_Reshape_2/shape (Te (3,)                 0           tf_op_layer_strided_slice[0][0]  
__________________________________________________________________________________________________
tf_op_layer_concat_8 (TensorFlo (None, 13, 13, 3, 4) 0           tf_op_layer_Mul_5[0][0]          
                                                                 tf_op_layer_Mul_6[0][0]          
__________________________________________________________________________________________________
tf_op_layer_Reshape_5/shape (Te (3,)                 0           tf_op_layer_strided_slice_1[0][0]
__________________________________________________________________________________________________
tf_op_layer_Sigmoid_1 (TensorFl (None, 26, 26, 3, 1) 0           tf_op_layer_split_3[0][2]        
__________________________________________________________________________________________________
tf_op_layer_Sigmoid_2 (TensorFl (None, 26, 26, 3, 80 0           tf_op_layer_split_3[0][3]        
__________________________________________________________________________________________________
tf_op_layer_Sigmoid_4 (TensorFl (None, 13, 13, 3, 1) 0           tf_op_layer_split_4[0][2]        
__________________________________________________________________________________________________
tf_op_layer_Sigmoid_5 (TensorFl (None, 13, 13, 3, 80 0           tf_op_layer_split_4[0][3]        
__________________________________________________________________________________________________
tf_op_layer_Reshape_2 (TensorFl (None, None, 4)      0           tf_op_layer_concat_7[0][0]       
                                                                 tf_op_layer_Reshape_2/shape[0][0]
__________________________________________________________________________________________________
tf_op_layer_Reshape_5 (TensorFl (None, None, 4)      0           tf_op_layer_concat_8[0][0]       
                                                                 tf_op_layer_Reshape_5/shape[0][0]
__________________________________________________________________________________________________
tf_op_layer_Mul_3 (TensorFlowOp (None, 26, 26, 3, 80 0           tf_op_layer_Sigmoid_1[0][0]      
                                                                 tf_op_layer_Sigmoid_2[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_1/shape (Te (3,)                 0           tf_op_layer_strided_slice[0][0]  
__________________________________________________________________________________________________
tf_op_layer_Mul_7 (TensorFlowOp (None, 13, 13, 3, 80 0           tf_op_layer_Sigmoid_4[0][0]      
                                                                 tf_op_layer_Sigmoid_5[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_4/shape (Te (3,)                 0           tf_op_layer_strided_slice_1[0][0]
__________________________________________________________________________________________________
tf_op_layer_concat_9 (TensorFlo (None, None, 4)      0           tf_op_layer_Reshape_2[0][0]      
                                                                 tf_op_layer_Reshape_5[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_1 (TensorFl (None, None, 80)     0           tf_op_layer_Mul_3[0][0]          
                                                                 tf_op_layer_Reshape_1/shape[0][0]
__________________________________________________________________________________________________
tf_op_layer_Reshape_4 (TensorFl (None, None, 80)     0           tf_op_layer_Mul_7[0][0]          
                                                                 tf_op_layer_Reshape_4/shape[0][0]
__________________________________________________________________________________________________
tf_op_layer_Shape_2 (TensorFlow (3,)                 0           tf_op_layer_concat_9[0][0]       
__________________________________________________________________________________________________
tf_op_layer_concat_10 (TensorFl (None, None, 80)     0           tf_op_layer_Reshape_1[0][0]      
                                                                 tf_op_layer_Reshape_4[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_2 (Te (2,)                 0           tf_op_layer_Shape_2[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Max (TensorFlowOpLa (None, None)         0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Shape_3 (TensorFlow (3,)                 0           tf_op_layer_concat_9[0][0]       
__________________________________________________________________________________________________
tf_op_layer_Prod (TensorFlowOpL ()                   0           tf_op_layer_strided_slice_2[0][0]
__________________________________________________________________________________________________
tf_op_layer_Shape_4 (TensorFlow (3,)                 0           tf_op_layer_concat_9[0][0]       
__________________________________________________________________________________________________
tf_op_layer_GreaterEqual (Tenso (None, None)         0           tf_op_layer_Max[0][0]            
__________________________________________________________________________________________________
tf_op_layer_strided_slice_3 (Te (0,)                 0           tf_op_layer_Shape_3[0][0]        
__________________________________________________________________________________________________
tf_op_layer_concat_11/values_1  (1,)                 0           tf_op_layer_Prod[0][0]           
__________________________________________________________________________________________________
tf_op_layer_strided_slice_4 (Te (1,)                 0           tf_op_layer_Shape_4[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Reshape_7 (TensorFl (None,)              0           tf_op_layer_GreaterEqual[0][0]   
__________________________________________________________________________________________________
tf_op_layer_concat_11 (TensorFl (2,)                 0           tf_op_layer_strided_slice_3[0][0]
                                                                 tf_op_layer_concat_11/values_1[0]
                                                                 tf_op_layer_strided_slice_4[0][0]
__________________________________________________________________________________________________
tf_op_layer_Where (TensorFlowOp (None, 1)            0           tf_op_layer_Reshape_7[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_6 (TensorFl (None, 4)            0           tf_op_layer_concat_9[0][0]       
                                                                 tf_op_layer_concat_11[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Squeeze (TensorFlow (None,)              0           tf_op_layer_Where[0][0]          
__________________________________________________________________________________________________
tf_op_layer_GatherV2 (TensorFlo (None, 4)            0           tf_op_layer_Reshape_6[0][0]      
                                                                 tf_op_layer_Squeeze[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Shape_8 (TensorFlow (3,)                 0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Shape_9 (TensorFlow (2,)                 0           tf_op_layer_GatherV2[0][0]       
__________________________________________________________________________________________________
tf_op_layer_Shape_5 (TensorFlow (3,)                 0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_8 (Te ()                   0           tf_op_layer_Shape_8[0][0]        
__________________________________________________________________________________________________
tf_op_layer_strided_slice_9 (Te ()                   0           tf_op_layer_Shape_9[0][0]        
__________________________________________________________________________________________________
tf_op_layer_strided_slice_5 (Te (2,)                 0           tf_op_layer_Shape_5[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Reshape_10/shape (T (3,)                 0           tf_op_layer_strided_slice_8[0][0]
                                                                 tf_op_layer_strided_slice_9[0][0]
__________________________________________________________________________________________________
tf_op_layer_Shape_6 (TensorFlow (3,)                 0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Prod_1 (TensorFlowO ()                   0           tf_op_layer_strided_slice_5[0][0]
__________________________________________________________________________________________________
tf_op_layer_Shape_7 (TensorFlow (3,)                 0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_10 (TensorF (None, None, None)   0           tf_op_layer_GatherV2[0][0]       
                                                                 tf_op_layer_Reshape_10/shape[0][0
__________________________________________________________________________________________________
tf_op_layer_strided_slice_6 (Te (0,)                 0           tf_op_layer_Shape_6[0][0]        
__________________________________________________________________________________________________
tf_op_layer_concat_12/values_1  (1,)                 0           tf_op_layer_Prod_1[0][0]         
__________________________________________________________________________________________________
tf_op_layer_strided_slice_7 (Te (1,)                 0           tf_op_layer_Shape_7[0][0]        
__________________________________________________________________________________________________
tf_op_layer_Reshape_9 (TensorFl (None,)              0           tf_op_layer_GreaterEqual[0][0]   
__________________________________________________________________________________________________
tf_op_layer_split_5 (TensorFlow [(None, None, 2), (N 0           tf_op_layer_Reshape_10[0][0]     
__________________________________________________________________________________________________
tf_op_layer_concat_12 (TensorFl (2,)                 0           tf_op_layer_strided_slice_6[0][0]
                                                                 tf_op_layer_concat_12/values_1[0]
                                                                 tf_op_layer_strided_slice_7[0][0]
__________________________________________________________________________________________________
tf_op_layer_Where_1 (TensorFlow (None, 1)            0           tf_op_layer_Reshape_9[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_13 (T (None, None, 2)      0           tf_op_layer_split_5[0][1]        
__________________________________________________________________________________________________
tf_op_layer_Reshape_8 (TensorFl (None, 80)           0           tf_op_layer_concat_10[0][0]      
                                                                 tf_op_layer_concat_12[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Squeeze_1 (TensorFl (None,)              0           tf_op_layer_Where_1[0][0]        
__________________________________________________________________________________________________
tf_op_layer_strided_slice_12 (T (None, None, 2)      0           tf_op_layer_split_5[0][0]        
__________________________________________________________________________________________________
tf_op_layer_RealDiv (TensorFlow (None, None, 2)      0           tf_op_layer_strided_slice_13[0][0
__________________________________________________________________________________________________
tf_op_layer_RealDiv_2 (TensorFl (None, None, 2)      0           tf_op_layer_strided_slice_13[0][0
__________________________________________________________________________________________________
tf_op_layer_GatherV2_1 (TensorF (None, 80)           0           tf_op_layer_Reshape_8[0][0]      
                                                                 tf_op_layer_Squeeze_1[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Sub_2 (TensorFlowOp (None, None, 2)      0           tf_op_layer_strided_slice_12[0][0
                                                                 tf_op_layer_RealDiv[0][0]        
__________________________________________________________________________________________________
tf_op_layer_AddV2_2 (TensorFlow (None, None, 2)      0           tf_op_layer_strided_slice_12[0][0
                                                                 tf_op_layer_RealDiv_2[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Shape_10 (TensorFlo (3,)                 0           tf_op_layer_concat_10[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Shape_11 (TensorFlo (2,)                 0           tf_op_layer_GatherV2_1[0][0]     
__________________________________________________________________________________________________
tf_op_layer_RealDiv_1 (TensorFl (None, None, 2)      0           tf_op_layer_Sub_2[0][0]          
__________________________________________________________________________________________________
tf_op_layer_RealDiv_3 (TensorFl (None, None, 2)      0           tf_op_layer_AddV2_2[0][0]        
__________________________________________________________________________________________________
tf_op_layer_strided_slice_10 (T ()                   0           tf_op_layer_Shape_10[0][0]       
__________________________________________________________________________________________________
tf_op_layer_strided_slice_11 (T ()                   0           tf_op_layer_Shape_11[0][0]       
__________________________________________________________________________________________________
tf_op_layer_strided_slice_14 (T (None, None, 1)      0           tf_op_layer_RealDiv_1[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_15 (T (None, None, 1)      0           tf_op_layer_RealDiv_1[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_16 (T (None, None, 1)      0           tf_op_layer_RealDiv_3[0][0]      
__________________________________________________________________________________________________
tf_op_layer_strided_slice_17 (T (None, None, 1)      0           tf_op_layer_RealDiv_3[0][0]      
__________________________________________________________________________________________________
tf_op_layer_Reshape_11/shape (T (3,)                 0           tf_op_layer_strided_slice_10[0][0
                                                                 tf_op_layer_strided_slice_11[0][0
__________________________________________________________________________________________________
tf_op_layer_concat_13 (TensorFl (None, None, 4)      0           tf_op_layer_strided_slice_14[0][0
                                                                 tf_op_layer_strided_slice_15[0][0
                                                                 tf_op_layer_strided_slice_16[0][0
                                                                 tf_op_layer_strided_slice_17[0][0
__________________________________________________________________________________________________
tf_op_layer_Reshape_11 (TensorF (None, None, None)   0           tf_op_layer_GatherV2_1[0][0]     
                                                                 tf_op_layer_Reshape_11/shape[0][0
__________________________________________________________________________________________________
tf_op_layer_concat_14 (TensorFl (None, None, None)   0           tf_op_layer_concat_13[0][0]      
                                                                 tf_op_layer_Reshape_11[0][0]     
==================================================================================================
Total params: 6,062,814
Trainable params: 6,056,606
Non-trainable params: 6,208
__________________________________________________________________________________________________
jnissin commented 2 years ago

Additionally, if I use the Keras model api with keras model .predict function and batch_size = 1 I get the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: ConcatOp : Dimensions of inputs should match: shape[0] = [1,0,84] vs. shape[1] = [1,1,84] [Op:ConcatV2] name: concat

I think this is due to different images having different number of detected bounding boxes 0 vs. 1. Is there any way around this?