luxonis / depthai-ml-training

Some Example Neural Models that we've trained along with the training scripts
MIT License
118 stars 32 forks source link

converting ssd mobilenet v2 to tflite fails #21

Closed UcefMountacer closed 1 year ago

UcefMountacer commented 2 years ago

Hi,

I trained the model above on custom dataset. I tried next to use google API to convert to tflite, but it fails.

ValueError: ssd_mobilenet_v2 is not supported. See `model_builder.py` for features extractors compatible with different versions of Tensorflow

Can someone please help me ?

UcefMountacer commented 2 years ago

solved this issue by changing the config.pipeline file. Specificaly changing the type to ssd_mobilenet_v2_keras

feature_extractor {
      type: "ssd_mobilenet_v2_keras"

But I get other issue :

AssertionError: Some objects had attributes which were not restored: ["\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_0/BoxEncodingPredictor/kernel:0' shape=(1, 1, 576, 12) dtype=float32, numpy=\narray([[[[-0.00353977, -0.01397507, 0.01734572, ..., 0.03560463,\n -0.01239335, -0.0155505 ],\n [-0.03036032, -0.01680149, 0.04920658, ..., -0.01738364,\n 0.02705415, 0.00090108],\n [ 0.00575145, -0.04150582, -0.015214 , ..., 0.02388693,\n -0.01513574, 0.04126819],\n ...,\n [-0.00814039, -0.00463374, -0.02372164, ..., 0.01749315,\n -0.0159109 , 0.00963738],\n [ 0.01002159, 0.00251435, -0.01235176, ..., 0.05216685,\n 0.02848465, -0.0051333 ],\n [-0.00791481, -0.01675018, -0.04415825, ..., -0.04309633,\n 0.02927049, 0.02141595]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_0/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_0/BoxEncodingPredictor/bias:0' shape=(12,) dtype=float32, numpy=array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_0/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_0/ClassPredictor/kernel:0' shape=(1, 1, 576, 33) dtype=float32, numpy=\narray([[[[-4.73361425e-02, -1.35701634e-02, 4.11093123e-02, ...,\n 2.52814405e-02, -1.09649915e-02, 1.86141022e-02],\n [-3.92971039e-02, -9.38551314e-03, -3.55799198e-02, ...,\n -1.24134244e-02, 3.48169468e-02, -7.61906058e-03],\n [ 1.14542842e-02, 9.39565524e-03, 1.67910755e-02, ...,\n 1.64198726e-02, -3.35430726e-02, 9.27996822e-03],\n ...,\n [ 7.96098084e-06, 8.52398202e-03, 1.39853638e-02, ...,\n 3.14348005e-02, 5.22018829e-03, 1.58390086e-02],\n [-3.26098339e-03, 5.61109409e-02, -2.38810834e-02, ...,\n 1.57650057e-02, -4.66677137e-02, -3.37731838e-02],\n [-6.23668544e-03, 1.04530156e-02, -5.12680300e-02, ...,\n 5.93748456e-03, -3.63899805e-02, -1.81496460e-02]]]],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_0/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_0/ClassPredictor/bias:0' shape=(33,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_0/ClassPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_1/BoxEncodingPredictor/kernel:0' shape=(1, 1, 1280, 24) dtype=float32, numpy=\narray([[[[ 0.03152776, -0.01332598, 0.00109464, ..., 0.01721956,\n -0.03347777, 0.00863572],\n [-0.02453681, -0.03284866, 0.00243431, ..., 0.04829283,\n 0.01132073, 0.02875043],\n [ 0.01620369, -0.03292797, -0.0196151 , ..., -0.01240744,\n 0.03619923, -0.03248971],\n ...,\n [ 0.00077415, -0.01719795, -0.00195341, ..., 0.04045237,\n 0.04286491, -0.02500083],\n [-0.05297136, -0.03250455, 0.00977308, ..., 0.00729641,\n 0.02459692, 0.00709538],\n [-0.02206502, 0.00670154, -0.0545417 , ..., 0.0208296 ,\n -0.02918178, 0.03652996]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_1/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_1/BoxEncodingPredictor/bias:0' shape=(24,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_1/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_1/ClassPredictor/kernel:0' shape=(1, 1, 1280, 66) dtype=float32, numpy=\narray([[[[ 0.03347358, 0.03715669, -0.00064987, ..., -0.04874873,\n 0.01142627, -0.04175203],\n [-0.00642464, 0.03568555, -0.00762119, ..., 0.03837829,\n 0.03626569, -0.01981836],\n [-0.01537779, 0.01614241, -0.00497179, ..., -0.03322134,\n -0.01083142, -0.00591151],\n ...,\n [-0.02111357, -0.05603074, 0.03635884, ..., 0.01028535,\n 0.00541 , 0.00806705],\n [-0.00831379, -0.03715224, -0.00218319, ..., -0.0173193 ,\n 0.00272634, 0.01054496],\n [-0.03176259, 0.05305205, -0.00974085, ..., -0.00300562,\n 0.03064571, 0.01002656]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_1/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_1/ClassPredictor/bias:0' shape=(66,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_1/ClassPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_2/BoxEncodingPredictor/kernel:0' shape=(1, 1, 512, 24) dtype=float32, numpy=\narray([[[[ 0.03436847, 0.02574596, 0.05837185, ..., 0.01592757,\n -0.00476729, 0.01187066],\n [-0.0127403 , -0.0124322 , -0.00066057, ..., -0.05593235,\n -0.00314809, 0.0182197 ],\n [-0.01647818, -0.03395518, -0.02487185, ..., 0.01606384,\n -0.00554948, 0.039044 ],\n ...,\n [ 0.03096213, -0.02694852, 0.0342383 , ..., 0.00146979,\n -0.03302303, 0.01938569],\n [ 0.04146077, -0.01732549, 0.04119679, ..., 0.02115851,\n -0.00043294, 0.01786848],\n [-0.02861186, -0.02394577, -0.03172853, ..., 0.05397759,\n 0.02042069, -0.03382159]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_2/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_2/BoxEncodingPredictor/bias:0' shape=(24,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_2/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_2/ClassPredictor/kernel:0' shape=(1, 1, 512, 66) dtype=float32, numpy=\narray([[[[-0.00507698, 0.00711507, -0.02344349, ..., 0.04228187,\n 0.01084706, 0.0398165 ],\n [ 0.01262511, -0.01214968, 0.0266158 , ..., 0.01336281,\n 0.00771089, -0.00950682],\n [-0.00754767, 0.03228619, -0.01990817, ..., -0.05803211,\n -0.02470423, -0.01563398],\n ...,\n [-0.02153932, 0.00592228, -0.05782442, ..., 0.02675459,\n 0.01200101, 0.03088211],\n [-0.02597205, -0.05886168, 0.03702454, ..., -0.00912493,\n 0.0462767 , 0.0452249 ],\n [ 0.02171947, -0.02346371, 0.03011537, ..., 0.03712053,\n 0.0009347 , -0.02248308]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_2/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_2/ClassPredictor/bias:0' shape=(66,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_2/ClassPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_3/BoxEncodingPredictor/kernel:0' shape=(1, 1, 256, 24) dtype=float32, numpy=\narray([[[[-0.02096722, -0.02968073, -0.0057104 , ..., 0.02782683,\n 0.03171792, 0.02504098],\n [-0.00369045, -0.0223901 , 0.01689696, ..., 0.01643143,\n -0.0211035 , -0.01511051],\n [-0.03704125, -0.01384353, 0.0257047 , ..., -0.01163486,\n -0.00777113, -0.008053 ],\n ...,\n [-0.04880718, 0.01286682, -0.01722637, ..., -0.00837793,\n 0.02359398, -0.05759956],\n [-0.02419004, 0.00591231, 0.01777357, ..., -0.02327529,\n 0.01344262, -0.01535662],\n [ 0.03428708, 0.02164519, -0.02404649, ..., 0.03461509,\n 0.03499486, 0.02165806]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_3/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_3/BoxEncodingPredictor/bias:0' shape=(24,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_3/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_3/ClassPredictor/kernel:0' shape=(1, 1, 256, 66) dtype=float32, numpy=\narray([[[[ 0.0341297 , -0.0088731 , -0.0195508 , ..., -0.00963709,\n -0.0119713 , -0.05281904],\n [-0.0076659 , -0.02482111, 0.05401079, ..., -0.00968939,\n -0.00293948, 0.04889498],\n [-0.01729682, -0.00242681, 0.036368 , ..., -0.01999251,\n 0.01737594, 0.00970263],\n ...,\n [ 0.00205813, -0.0340769 , -0.02673898, ..., -0.02841303,\n -0.0106734 , 0.00378467],\n [-0.02838509, 0.00512955, -0.0224792 , ..., -0.00503378,\n 0.01699257, 0.0593842 ],\n [-0.00327886, -0.00060595, -0.00141401, ..., -0.00620073,\n -0.01136533, 0.04027086]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_3/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_3/ClassPredictor/bias:0' shape=(66,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_3/ClassPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_4/BoxEncodingPredictor/kernel:0' shape=(1, 1, 256, 24) dtype=float32, numpy=\narray([[[[-0.02408588, -0.00153392, 0.01763866, ..., -0.01635682,\n 0.00429203, 0.01417955],\n [ 0.02341155, 0.00287857, -0.00094201, ..., 0.02051987,\n -0.0282689 , 0.0230975 ],\n [ 0.02274154, 0.02557619, 0.05623041, ..., 0.0344967 ,\n 0.02165505, 0.05614285],\n ...,\n [-0.03134238, -0.0344104 , -0.04298472, ..., -0.03879514,\n 0.04718707, 0.04621619],\n [-0.0460134 , 0.0097754 , -0.00800176, ..., -0.03098567,\n -0.02019552, -0.02650209],\n [ 0.0279598 , 0.00749728, 0.03775411, ..., -0.01650815,\n -0.01157677, 0.03751995]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_4/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_4/BoxEncodingPredictor/bias:0' shape=(24,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_4/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_4/ClassPredictor/kernel:0' shape=(1, 1, 256, 66) dtype=float32, numpy=\narray([[[[-0.01678981, -0.01756805, 0.04277205, ..., 0.01218454,\n 0.00837029, -0.01109456],\n [ 0.0222201 , 0.00884666, 0.04032696, ..., 0.01776438,\n 0.00145717, 0.01006595],\n [ 0.04983577, -0.00376139, -0.01069636, ..., 0.03694621,\n 0.01158044, 0.00873081],\n ...,\n [-0.03925031, 0.01535036, -0.01034442, ..., 0.03676206,\n -0.01009617, -0.01047314],\n [-0.04744387, 0.01186625, 0.03245588, ..., -0.02385576,\n 0.01009255, -0.0543104 ],\n [-0.04030129, 0.01504495, 0.04806686, ..., -0.00168714,\n 0.04227632, -0.00147535]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_4/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_4/ClassPredictor/bias:0' shape=(66,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_4/ClassPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_5/BoxEncodingPredictor/kernel:0' shape=(1, 1, 128, 24) dtype=float32, numpy=\narray([[[[-0.00996535, -0.04341441, -0.0286233 , ..., -0.00452522,\n -0.01676013, 0.00951348],\n [-0.0402015 , -0.03710153, 0.03313768, ..., 0.0294655 ,\n -0.04066699, -0.00409435],\n [ 0.01319572, 0.01720616, 0.03904019, ..., -0.04061081,\n 0.04221414, -0.05316586],\n ...,\n [ 0.01139488, 0.03364403, 0.0211183 , ..., 0.01093071,\n -0.0043282 , -0.02726141],\n [ 0.00581437, 0.05973228, 0.00194513, ..., 0.01048921,\n 0.02090081, 0.01023033],\n [ 0.01013442, 0.01845738, 0.02719586, ..., 0.02445981,\n -0.0063652 , -0.02858859]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_5/BoxEncodingPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalBoxHead_5/BoxEncodingPredictor/bias:0' shape=(24,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0.], dtype=float32)>: ['BoxPredictor/ConvolutionalBoxHead_5/BoxEncodingPredictor/bias']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_5/ClassPredictor/kernel:0' shape=(1, 1, 128, 66) dtype=float32, numpy=\narray([[[[ 0.00627487, -0.01152116, -0.02544831, ..., -0.01615847,\n 0.05702579, 0.02893693],\n [ 0.0276499 , -0.04182994, -0.05616939, ..., -0.01276666,\n -0.00949273, -0.03975037],\n [-0.03910051, 0.00444506, -0.00094274, ..., 0.00093974,\n -0.03342527, -0.00935674],\n ...,\n [ 0.00393518, 0.00599322, 0.04459492, ..., -0.03099255,\n -0.02859994, 0.03143781],\n [-0.01838499, 0.01760786, 0.00500335, ..., 0.00257418,\n -0.00117251, 0.01690561],\n [ 0.02157811, -0.01350481, 0.03643173, ..., -0.02353792,\n 0.00888211, 0.02654057]]]], dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_5/ClassPredictor/kernel']", "\n <tf.Variable 'BoxPredictor/ConvolutionalClassHead_5/ClassPredictor/bias:0' shape=(66,) dtype=float32, numpy=\narray([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n dtype=float32)>: ['BoxPredictor/ConvolutionalClassHead_5/ClassPredictor/bias']"]

conorsim commented 2 years ago

Hi @UcefMountacer. Sorry, which line in the notebook are you receiving this error?

tersekmatija commented 1 year ago

Closing due to inactivity.