eloquentarduino / EloquentTinyML

Eloquent interface to Tensorflow Lite for Microcontrollers
299 stars 57 forks source link

Problem in apply Conv2D on my own case when refer to your digits example. #50

Closed whubaichuan closed 2 years ago

whubaichuan commented 2 years ago

Hi, recently I am doing an interesting project about using Conv2D or Dense to detect 2-classification-issues. I refer to your digits example.

I see in your digits example, you train the model using N*8*8*1 data. But in DigitsExample.ino, you input the 1*64 data to test. If it was in the Keras environment, the test input should also be 1*8*8*1. Does that mean in Arduino environment, the EloquentTinyML will regards all the input in one dimension structure as the 1*8*8*1 structure according to the .h network file, as you said here.

Next, it's my own project. Actually, my training data is N*1024. Next, I tested two different types of models. One is Conv2D and Dense, and other is fully Dense. I am sure I have made optimize=False as told here.

  1. Conv2D and Dense doesn't work

where the input is 1*32*32*1 and the output is 2-classification. I refer to your digits example, have the model in Keras like this:

model = tf.keras.Sequential()
model.add(layers.Conv2D(8, (3, 3), activation='relu', input_shape=(32, 32, 1)))
model.add(layers.Flatten()) 
#Flatten works in your digits example although Flatten seems to be unsupport by TFLite. 
#But anyway, I also have tried layers.Reshape() here, which should be supported by TFLite.
model.add(layers.Dense(2))

In Keras training, I reshape my training data into N*32*32*1. In the Arduino project, I reshape my data into 1*1024, which is similar to your 1*64 in digits. But the Predicted proba are 0.0 , 0.0, which is so weird.

  1. fully Dense works

where the input is 1*1024 and the output is 2-classification. The model is:

model = tf.keras.models.Sequential([
tf.keras.layers.Dense(10, activation=tf.nn.relu,input_shape=(1024,)),
tf.keras.layers.Dense(2)
])

In Keras training, I reshape my training data into N*1024. In the Arduino project, I also reshape my data into 1*1024, which is similar to your 1*64 in digits. It works normally. The Predicted proba are 0.90 , 0.10, which is ok.

Now I am stuck with this tricky problem. I guess the reason is the data structure problem. But perhaps there are another aspects I haven't considered. Do you have another advice for me?

Looking forward to your reply.

Best wishes

eloquentarduino commented 2 years ago

Can I see the data set? Also, which version of TF are you using?

whubaichuan commented 2 years ago

@eloquentarduino hi, one example of data 1*1024 is :

float x_test[1024] = {-0.06448305058721761,-0.17836999989388502,-0.12258710468552886,-0.31052685648476974,-0.38262579301428384,-0.3332177841866167,-0.40394477057068706,-0.1661914527554845,-0.14370265725357373,-0.16496679454972513,-0.19555417756958987,-0.17729064362243888,-0.09682711914316249,-0.12436193145423562,-0.1552695051283168,-0.20016971341821915,-0.21710855284598662,-0.16469292917817305,-0.07472331069344791,0.013321807424841136,-0.05865138405551554,-0.05908285192701577,-0.03838014135621375,-0.023760041297648818,0.06254668115531059,0.11348508492733819,0.08935422259379233,0.17486494234706296,-0.056143649125266364,-0.08200761398609457,-0.032743941753975936,0.20970614111909164,0.24237065999625093,0.3797523925510097,0.43123676165710917,0.24952161632963307,0.23160244651857426,0.27643685696234094,0.18398822146844238,0.16058144933259016,0.24321203957682766,0.0020172972602788084,0.0690625509579853,0.0870467084454029,0.15074376815432308,0.21352603972460693,0.24342240874300744,0.3228789375538727,0.288208804445636,0.2740316126048805,0.13452704828999323,0.08057527065710975,0.03263920894519019,0.04198722546288908,0.07067523880220428,0.12644597589235243,0.0833620921810991,0.008706925106669608,0.10125722766354792,0.11689479280159926,0.07089623228143606,0.25878507572845855,0.11046063520557435,0.07401894733855446,0.144557481899811,0.22638362010072777,0.23184348010761385,0.22513240666121534,0.2062193516795875,0.03835969616626138,0.15133154641147947,0.22773095451982722,0.19064393166170746,0.38047114165082707,0.24303932138960563,0.0917277213094672,0.25732968453458954,0.2300157496403091,0.23257037618654924,0.5060929550303774,0.3547744841323576,0.019807197115212064,-0.017605048137457793,-0.21963597436819662,-0.20568877189072382,0.06517211320190651,0.030858409781287063,0.0017171751368199857,-0.14446776263996097,-0.19552776371000685,-0.17225271217942226,-0.19845738340150862,-0.26217588677556325,-0.2647565268944236,-0.14072833565582307,-0.2873265881396568,-0.04687250231793151,-0.1486856038310674,-0.23818844482467075,-0.18261554085175202,-0.1712691603702777,-0.16066017769279733,-0.24547983703137138,-0.17433931902975072,-0.1475700546295571,-0.24282206281908092,-0.17258733251847114,-0.20860483994139073,-0.2856003071660455,-0.24669107399883813,-0.19267565352579993,-0.23548467244145874,-0.28313204915917967,-0.30901747682969133,-0.3271171571343226,-0.37433808105229743,-0.31966228260249807,-0.403496487858844,-0.5589710348210146,-0.6038997192657387,-0.7003319954341806,-0.837923097009028,-0.7314617548376581,-0.6204005864775302,-0.5113223104766456,-0.5934726759293577,-0.5792066836556866,-0.6537543284126112,-0.521639696088781,-0.4217241593273932,-0.3979041062368499,-0.2910277507741779,-0.31653094056435865,-0.31271284702420393,-0.17190558801564598,-0.08957899475552873,-0.11081953284203906,-0.03474752513145364,-0.04273803850366873,-0.0945893286133175,-0.1092083831681716,-0.12328859725937506,-0.06884955708624804,-0.13204973448411933,-0.11285135007265497,-0.07342209572558546,-0.049653764389375445,-0.0060185542033113016,-0.012304230728715539,-0.03033137379449479,-0.0870801042477328,-0.051060493077810236,-0.09716156027806523,-0.09360847231298426,-0.021409110896949923,-0.019288562768526724,0.007279694880883179,0.03109176933235884,-0.003474912649559697,-0.04721441894953761,-0.10420688295944645,-0.125111532527651,-0.09964011781834058,-0.04368686304991073,0.03676178269467669,0.05320726680489388,-0.008322872148846333,0.0004626952428059367,-0.05966731863952908,-0.02806186225476696,0.0006996696958790644,0.0499386946349669,0.010813660107911276,-0.10732982981505824,-0.07139805397409209,-0.03921355006813629,0.009009420496005904,0.04099931120320911,0.0533418627986692,0.04253126040500153,0.06528986415156832,0.12228021356375059,0.15960670518015266,0.08372372982390724,0.006459690350206255,-0.01248786932106023,-0.03834896874779947,-0.05952857894653085,0.053137210651987336,0.19349836556919017,0.22723686795141687,0.24964362126010337,0.2992181947533352,0.2381853832373865,0.19781302925700686,0.28022986254133786,0.3639440049886739,0.49112866767507135,0.5565064194523442,0.4971357212400718,0.5076265238262139,0.39526762926183945,0.4302844776044973,0.420920889576361,0.24457877925128055,0.3038077879672332,0.32222883179434625,0.25225644609122055,0.2568586127366754,0.20205183857510467,0.09981149233248898,0.0417714935272594,0.0062164296319931565,-0.0026660564471514417,-0.11045485805656419,-0.09330518453446485,-0.1587807412988783,-0.12993409946838858,-0.2026265286213503,-0.2063194394120462,-0.31707495356896587,-0.3403044524109259,-0.265826726532376,-0.19467392586686375,-0.16763208606312263,-0.14764206352537496,-0.1261193812417531,-0.18396465488624775,-0.22590975411768877,-0.21706701333731385,-0.21283676080538105,-0.21546658386430362,-0.08517473296156217,-0.08397857457485829,-0.13418613751963562,-0.05665777656248427,-0.07465324024351906,-0.13348389243725253,-0.09047546847970046,-0.13089797866537128,-0.09940726543960572,-0.06422951178995304,-0.0183392833127454,-0.034132980967429546,-0.04899011572392867,-0.07714720444608565,-0.034806863601023204,-0.0036635745412776674,0.04104779263684857,0.17397405437771551,0.13982274977378295,0.12929718007609436,0.09876263748471063,0.15922211203792347,0.13467759741167148,0.22383216375027315,0.1979909654357368,0.11584274350362314,0.07906774074656625,0.04910099981924296,0.07243153259127154,0.15866013056379824,0.21790653548589348,0.1885144732949406,0.14468973309333996,0.1434233441888209,0.11986729568546982,0.12069912078827504,0.14754531005514557,0.12537936618606216,0.07824040393489273,0.03002179938779635,0.04691833235224311,0.11799843610447355,0.13349212787458392,0.13769867227876095,0.06570222177168468,0.004411043695357046,0.022185028996251445,0.05632013926878469,0.09660843944969981,0.05588614213808933,0.08687527540898023,0.08446574132485458,0.055869771369153526,0.08958807233859105,0.12736331740082135,0.10496382552344409,0.09363805469945743,0.12073110636487282,0.10251106935323907,0.12845001542087275,0.09530932141155367,0.08841208863965656,0.07360950909181198,0.016579778502115478,0.05295423517404667,0.03775772562229324,-0.05948607447573818,-0.033710439406407756,-0.12696922558748996,-0.18556698399853322,-0.14777207051102406,-0.11829639416817876,-0.10505225517105886,-0.10580937485698443,-0.11902829033593568,-0.18590457054145199,-0.16372228077976095,-0.14451746495596246,-0.2051457902142508,-0.23681031387588988,-0.19956336667472077,-0.22209970867216974,-0.2604512730907799,-0.14804503283276096,-0.2150785840348491,-0.3158319017516044,-0.38116548201725736,-0.5689272105584645,-0.5847831111829568,-0.5751353677338458,-0.500156432972491,-0.39664595297149174,-0.45475007000560824,-0.5023131146191033,-0.38255917462731104,-0.4236700385105359,-0.31460264060738413,-0.25817513743218723,-0.2585905323982139,-0.2789251410797532,-0.21963815819575372,-0.13983523073193813,-0.2369755261802437,-0.3702084193225819,-0.3832381680387749,-0.4799176789569016,-0.4441561225257615,-0.40939364893859637,-0.46815813365676656,-0.5552565263315307,-0.5072659280785692,-0.36607537825925524,-0.3128593692372146,-0.2675406064663319,-0.29817290034015065,-0.262713241650532,-0.37034881309143364,-0.37026025084001496,-0.23263067691332576,-0.21960495726378346,-0.2016980519568507,-0.13356584501511912,-0.16182152035984548,-0.23083254913478007,-0.2612086186715561,-0.17785178876595845,-0.16204894994589344,-0.19624042102516573,-0.2455958811454021,-0.3645077265058055,-0.4400169920545628,-0.14408617015745728,0.16769559556226551,0.3127029278146002,0.43978069662450064,0.5512882917153272,0.5049687081289347,0.6371115968639754,0.8837895366172129,0.8507235087688723,0.8655510124850057,0.8994373590387937,0.9417887178737774,1.0334615721866647,1.3108563485739522,1.5312729113156933,1.5894371674225023,1.555152667117897,1.3814448306047704,1.4699170529136871,1.4666994640344944,1.474916884203047,1.7009689132855155,1.722113475457655,1.6649871047069627,1.7429206943880402,1.698197736218993,1.7506638412359474,1.8002069733760722,1.9066967539838702,1.7530361498029323,1.6046021992158872,1.6264410620731897,1.5225036119152733,1.4850687065989632,1.5194658496275182,1.4204652974723702,1.2294414501432445,1.0640813740820574,1.105050022876978,1.055044951743642,1.0003309095173738,1.1307833880272062,0.87242358542471,0.6540545927154989,0.6493880342168892,0.5927718682305813,0.5685007611774773,0.6799592305639296,0.5829064831129112,0.4728826313026144,0.38264439982724696,0.4152857377993175,0.4203040851357362,0.4085962251138678,0.3697279991656144,0.33457314427059276,0.453827646634988,0.47495521627731563,0.5660460991860418,0.6195722176878503,0.4336258464598802,0.525008148712267,0.46535078967153914,0.4076486613962112,0.43271468623792236,0.4798885057153919,0.40897692192435187,0.40819096134817445,0.38039119326829535,0.3502385641426267,0.2380427920279228,0.19696241694027475,0.20225392115478386,0.0517039308760396,-0.014561776828778404,-0.028892391479576698,-0.10912786319313506,-0.1334608775168204,-0.0008477394029007247,-0.17591918040589194,-0.22297423605921646,-0.19816122885104934,-0.2512577635524543,-0.1695108510102972,-0.13829724238334437,-0.032902426222236776,-0.02044149498621839,0.08388775619405049,0.1035019399102949,0.11423278961911447,0.11672182076196141,0.11055758040382803,0.0916265813886798,0.13142210849419708,0.16237346236912548,0.2603195895411105,0.33576963630864404,0.3119314224435227,0.34705204883013535,0.3483446187339445,0.3249590859906624,0.30178323530839146,0.22406885674931692,0.10264829692059393,0.06546113360491752,0.04165746487957454,0.0396540370978029,0.09505801696173655,0.052121105992377854,0.0629778152399668,0.04510825840469946,0.1754627417095653,0.1622714290898659,0.03607509001226791,-0.026131312413007344,-0.08127169254405037,-0.12370402815230762,-0.11902428393722922,-0.1077604818273511,-0.17996680857715378,-0.21169481025435874,-0.2261803409981276,-0.19397675557028632,-0.23343746860080666,-0.20092513117945207,-0.20177769316248634,-0.25362316365286547,-0.14252504387672157,-0.07224780044771796,-0.019668869851477637,-0.03776379074154636,-0.055623836966541655,-0.10639139127990274,-0.1562657992336846,-0.16847549802661463,-0.19746718544195122,-0.14028508540175508,-0.10456753881838357,-0.10779384280248869,-0.043327499698828,-0.061446723678661226,-0.04638442744408421,0.022773033335891493,0.02096885954664343,-0.08718842474797847,-0.09839653008248798,-0.13660387373935082,-0.1683324654460127,-0.044756290954462825,-0.008673508178325212,0.013058469774973346,0.0047811382678446465,-0.043037048435272514,-0.08119985967957094,-0.08661516223365302,-0.0746372783670395,-0.0811456288973329,-0.10015149371413574,-0.13346586623797244,-0.1434363366987993,-0.17025797934116318,-0.2449083114008813,-0.1740289546244326,-0.18844499549126356,-0.18464182655615594,-0.151900484779953,-0.09192130061237051,-0.10275091097779555,-0.044539307931016625,-0.052715060500655546,-0.049291078282333596,-0.040317842555055924,-0.03551897591160371,0.010080573897732741,-0.002552393368827914,0.020543797513354743,0.00788184449337932,0.005221395034957622,-0.05975121013201219,-0.024648346810931542,-0.02455708921603468,-0.07390961273639958,-0.11824577362683572,-0.1666967136864098,-0.15118195542397941,-0.1878340492692039,-0.14428449465216625,-0.11023373510037988,-0.11723231694743162,-0.09439654698235986,-0.08144718922479437,-0.055901100173607006,0.013775420673886981,0.012537838287365951,0.03521715292230997,0.04484510222599895,0.062030964514782266,0.1429696131051485,0.11035276950721064,0.08697074922294316,0.07799762303231594,-0.010686151146389468,-0.05235085030676439,-0.01329447843743248,-0.08719422230981999,-0.06744680068592203,-0.045976620400902,-0.08482010905180327,-0.1028066474605374,-0.09344053377168765,-0.03170632208348414,-0.0716000294718869,0.01581512756262181,0.09062928698886988,0.060034840004415335,0.06630851376749991,0.07082701973385881,-0.016000276727483085,-0.01585896532778982,0.051694197021771575,-0.03143773256724119,-0.05690309593975283,-0.005720358264215116,-0.08216816193938975,-0.050870973056439416,-0.0742625087241533,-0.04684534535878085,-0.06039574830746472,-0.06858497653945156,-0.034572959254980405,-0.08752278594283786,-0.1792549528295088,-0.24054042387521868,-0.2984251692038874,-0.2674673770200525,-0.04689644325045654,0.054108063799391294,-0.01593010090268257,-0.10218064683489907,-0.17363846644151157,-0.41799732946943613,-0.6026409809527299,-0.6657553775853161,-0.6362820170922676,-0.4769938572041534,-0.34658988573699523,-0.379349731335031,-0.3817282685113261,-0.5292957854897902,-0.6217298509407404,-0.577758089016694,-0.5270502447401897,-0.4973478084805726,-0.4548798621691452,-0.4182019248899512,-0.5070916876238913,-0.5046546954568982,-0.45512460030306207,-0.4227692295277471,-0.4657645162910649,-0.383635389330816,-0.3908158710884628,-0.4607341989856151,-0.40981450600927966,-0.3883187889769152,-0.4401953865499009,-0.46632574397845095,-0.3993980055304878,-0.44519631404621124,-0.413296222813246,-0.34584217117214167,-0.2851455083188987,-0.3556018358669031,-0.2850094961226785,-0.2517728508879225,-0.3571197842581918,-0.29176321461814275,-0.22033156112551994,-0.24893869724670517,-0.2413462742553716,-0.1644800158612341,-0.2106235484480847,-0.17997644541493432,-0.2000619223879069,-0.2106289822235868,-0.25420007277899,-0.2352791883029314,-0.22371994495719827,-0.2674159118108735,-0.29281563969491975,-0.3377986644173012,-0.28081689154852535,-0.2985642790924615,-0.25234329859756177,-0.21382261281061649,-0.23436964236489513,-0.22407058629002902,-0.24917519080887005,-0.19064300577614912,-0.14877613401396028,-0.11500707066130844,-0.09695704879684568,-0.0925861774846256,-0.10583700428439176,-0.05736964775095814,-0.04687076970832153,-0.06912597470900805,-0.11102392410214214,-0.03929663207020828,-0.08177075119379867,-0.07322897172040282,-0.05698778610991595,-0.09486789829926551,-0.1394769976766893,-0.0906622751768413,-0.09490417215303291,-0.07258837564890183,-0.09555046947021975,-0.16724032184069493,-0.1927967296598399,-0.14510933559942005,-0.14362422865287403,-0.15110261358099336,-0.1604168347818909,-0.12458904019155513,-0.030106096693759996,-0.02204844593894531,-0.0017751917867539818,0.028220810912951894,-0.04166265175310823,-0.0052992538187844095,0.17691390526878706,0.2703687818145332,0.29833451872229017,0.38222904984428197,0.3148381833018753,0.23050093680786307,0.36446334585989887,0.45699323824449384,0.5164544677891678,0.5557708248191426,0.44543849255331613,0.46107446508357586,0.5441837786994379,0.6798698144913558,0.7315650924029913,0.6873184132442832,0.6059371335603451,0.3921982052124914,0.4231502567883755,0.45615734289021376,0.50479969877279,0.48903369625688375,0.3145370850433018,0.3815090578308903,0.39814843912821646,0.40083385058824733,0.49064708381140637,0.5406514922339148,0.47946967050391665,0.4129348330642832,0.378692818053573,0.3308238565614279,0.3082582142604709,0.3447170418112927,0.30695459774937234,0.1575051365754987,0.09509382250888301,-0.006535342512486213,-0.1606599005097623,-0.23479570382692794,-0.2643435381443058,-0.296677844583286,-0.34092871125856655,-0.32087075996636816,-0.27894319265822975,-0.3012367834496431,-0.3199565406710667,-0.31076494434110935,-0.2958533018399927,-0.2795553558626269,-0.137607086853153,-0.11979653448838531,-0.08708158204234923,-0.0685025371258403,-0.10874953809033035,-0.08163048025203858,-0.11709647990655482,-0.06154079387840054,-0.034747524742753284,-0.07211512927605844,-0.08059144743009229,-0.1063163371514744,-0.19254180502163537,-0.1971195104562257,-0.22516171231780419,-0.2832731343147027,-0.24403594592548677,-0.1737238753526478,-0.18723131236445006,-0.15143391119171581,-0.19214160431445282,-0.32071192902882495,-0.4558146294383849,-0.5278743094524846,-0.4793552409597256,-0.31046172097204855,-0.2534038509132042,-0.2328152796433117,-0.24614909989842615,-0.24965507170947235,-0.24855598215841504,-0.1994958232802521,-0.21385471367763362,-0.24981859128629288,-0.2059943401694598,-0.20755652599003746,-0.22719522431771277,-0.1418820952261168,-0.11623584727092186,-0.15781520767927532,-0.022063959705824084,0.022806218169812147,-0.032066146795275835,0.13481897123419592,0.1107885596378435,0.1875419590659218,0.1864876228148994,0.19467979440562003,0.1516533739981168,0.025324322409497665,0.05884362731762758,0.11117016567435523,0.04670090016630218,0.03261043567998446,0.14243577287131587,0.029104851718213615,0.013321591212289537,0.12949245819634733,0.13886491052682115,0.260995102046868,0.2670160122377997,0.24099422986317934,0.18049953435893726,0.23870520594909753,0.2100552830488828,0.18578380390234914,0.17655132109224653,0.18498972329937982,0.18295697083974646,0.20289790671432262,0.1873249732625249,0.19214765429837224,0.07183811022516845,0.03844002155487052,0.03565988903511501,0.0029732572058961226,0.03117861638079596,0.01001341179410194,0.09112000721569295,-0.03472733981323286,-0.06500753202554854,-0.0766067626814929,-0.12844769113620746,-0.07417255451067323,-0.0097493144839627,0.13596296098338045,0.0570438177428047,-0.013939163086729258,-0.061952828357444235,-0.16907103783526564,-0.20883551269062928,-0.14328453243467984,-0.02346716108817631,0.04418997165476039,0.12368224825117059,0.13552336466092546,0.12216859273524149,0.09302573713490611,0.06494000108169093,0.0911336977600168,0.05749816381578984,-0.01842281973547762,-0.0772089255827698,-0.12318273430667893,-0.1659664706083372,-0.24326327594748326,-0.20706207189474662,-0.2018703643718789,-0.2898964311830673,-0.18044580052844134,-0.15756053490594077,-0.179042942510218,-0.12364577355937571,-0.076641949092053,-0.04686930467966302,0.0027229937003107265,0.0032014552967168457,0.09129739981040615,0.1561893746724061,0.27692412619063617,0.43459174973427966,0.22898315744543724,0.1155984520294808,0.09869929148578412,0.06346619620452502,0.18026388362467546,0.4106144580239142,0.4656032066279303,0.48306112309465254,0.4055192495037013,0.3025884580131941,0.29006204871166585,0.3141464644806798,0.33998799471169344,0.33505013109166637,0.2887324738227011,0.19396016013175388,0.13351458168452282,0.13099895717643406,0.18720298941489946,0.20961314756948643,0.14702200866710669,0.10081122709900031,-0.09422363540396314,-0.31119594720475546,-0.2605186080727598,-0.27563463285417567,-0.23188440948350203,0.021010507880922364,-0.05995342692495897,-0.23978556229137998,-0.35567835815403304,-0.4360851178420277,-0.44102522596550486,-0.3866975234134657,-0.34500856373046107,-0.36227884362630847,-0.372430938684837,-0.3928546765956464,-0.36779279961377326,-0.39319165665069455,-0.397990099750885,-0.287268473425612,-0.2850846578358749,-0.3218205260873665,-0.36565830759053797,-0.36380609867928476,-0.3207409558570729,-0.21240589699586873,-0.05241556721535798,-0.10685369292982694,-0.17327019959762,-0.2798798185759332,-0.3878357288328181,-0.2921981405369415,-0.3544406002479399,-0.3148589935543976,-0.24939303061696308,-0.1718647169580721,-0.13440256141848114,-0.1155656885715838,-0.15884053498117437,-0.22086225774744114,-0.2522826529094639,-0.3011604254774497,-0.3104709820784502,-0.3602840613818521,-0.32973810911533175,-0.4272177261383037,-0.5167113623055871,-0.5848375126430302,-0.5584954978368927,-0.4182236917622322,-0.3574713798222982,-0.35393427731729404,-0.3992771303933066,-0.5456446528862378,-0.5740213708087106,-0.38983697428511216,-0.2001572655065033,-0.02201951757900483,-0.06288802549187744,-0.09034489079339877,-0.16523231113650433,-0.06864696152186923,-0.16978227617819572,0.20931756569768187,0.2641313322283606,0.07190531405646926,0.1993458968327628,-0.0223569695550761,-0.26151765528488397,-0.17867978253948089,0.07883746881962109,0.12769482526527035,0.2961440162900481,0.39880340365676015,0.11371196413481888,-0.10904247440161857,-0.12730958469221287,-0.2609536296164606,0.04819142820157926,0.262942207361435,0.14970325936886023,0.13354464614913938,-0.010718167328822836,0.0025424987444891455,0.02683856447074525,0.29947047779806035,0.10015142200581517,-0.16910803876654057,0.018023648983703365,-0.10172339700735987,0.0038831713651805155,0.3159444491986531,0.12832443190828477,-0.19813395946680432,-0.2237766260779792,-0.18138817895362772,-0.37558336481867277,-0.022091975958297632,-0.19393860187485665,-0.2901195543389127,-0.27430080815568203,-0.42118609689330105,-0.18530696589512632,-0.0015282010099881887,0.1469099504408382,-0.1602951717726795,-0.04178911347968315,-0.2624027606027511,-0.5490671436782054,-0.31749535671203427,-0.15790128199026623,-0.28845655092557404,-0.16845858776303685,0.014611694678953005,-0.25851731678001566,-0.2823948276507427,-0.0670836205462527,-0.027488517990475025,0.1822306352784788,0.2845170457545591,0.27191750209469834,0.21530639611556698,0.30767327168569875,0.36297509698016933,0.35291846072238064,0.4969540890086276,0.2199406296713482,0.34918404915325535,0.5006195573095823,0.5970685418675513,0.6565025079306908,0.6464190935734794,0.49904111057735073,0.5519712010714525,0.712457142149062,0.7189641386762481,-0.2995198992520872}; 

In keras training process, I use:

tf.__version__ = 2.6.4
tf.keras.__version__=2.6.0

In Arduino project, I use:

EloquentTinyMl version = 2.4.3

And the code in .ino is (Here I just take one input as the example)

#include <EloquentTinyML.h>
#include <eloquent_tinyml/tensorflow.h>

#include "net.h"

#define N_INPUTS 1024
#define N_OUTPUTS 2
// in future projects
//you may need to tweak this value: it's a trial and error process
#define TENSOR_ARENA_SIZE 20*1024

Eloquent::TinyML::TensorFlow::TensorFlow<N_INPUTS, N_OUTPUTS, TENSOR_ARENA_SIZE> tf;

void setup() {
    Serial.begin(9600);
    tf.begin(model);
}

float x_test[1024] = {-0.06448305058721761,-0.17836999989388502,-0.12258710468552886,-0.31052685648476974,-0.38262579301428384,-0.3332177841866167,-0.40394477057068706,-0.1661914527554845,-0.14370265725357373,-0.16496679454972513,-0.19555417756958987,-0.17729064362243888,-0.09682711914316249,-0.12436193145423562,-0.1552695051283168,-0.20016971341821915,-0.21710855284598662,-0.16469292917817305,-0.07472331069344791,0.013321807424841136,-0.05865138405551554,-0.05908285192701577,-0.03838014135621375,-0.023760041297648818,0.06254668115531059,0.11348508492733819,0.08935422259379233,0.17486494234706296,-0.056143649125266364,-0.08200761398609457,-0.032743941753975936,0.20970614111909164,0.24237065999625093,0.3797523925510097,0.43123676165710917,0.24952161632963307,0.23160244651857426,0.27643685696234094,0.18398822146844238,0.16058144933259016,0.24321203957682766,0.0020172972602788084,0.0690625509579853,0.0870467084454029,0.15074376815432308,0.21352603972460693,0.24342240874300744,0.3228789375538727,0.288208804445636,0.2740316126048805,0.13452704828999323,0.08057527065710975,0.03263920894519019,0.04198722546288908,0.07067523880220428,0.12644597589235243,0.0833620921810991,0.008706925106669608,0.10125722766354792,0.11689479280159926,0.07089623228143606,0.25878507572845855,0.11046063520557435,0.07401894733855446,0.144557481899811,0.22638362010072777,0.23184348010761385,0.22513240666121534,0.2062193516795875,0.03835969616626138,0.15133154641147947,0.22773095451982722,0.19064393166170746,0.38047114165082707,0.24303932138960563,0.0917277213094672,0.25732968453458954,0.2300157496403091,0.23257037618654924,0.5060929550303774,0.3547744841323576,0.019807197115212064,-0.017605048137457793,-0.21963597436819662,-0.20568877189072382,0.06517211320190651,0.030858409781287063,0.0017171751368199857,-0.14446776263996097,-0.19552776371000685,-0.17225271217942226,-0.19845738340150862,-0.26217588677556325,-0.2647565268944236,-0.14072833565582307,-0.2873265881396568,-0.04687250231793151,-0.1486856038310674,-0.23818844482467075,-0.18261554085175202,-0.1712691603702777,-0.16066017769279733,-0.24547983703137138,-0.17433931902975072,-0.1475700546295571,-0.24282206281908092,-0.17258733251847114,-0.20860483994139073,-0.2856003071660455,-0.24669107399883813,-0.19267565352579993,-0.23548467244145874,-0.28313204915917967,-0.30901747682969133,-0.3271171571343226,-0.37433808105229743,-0.31966228260249807,-0.403496487858844,-0.5589710348210146,-0.6038997192657387,-0.7003319954341806,-0.837923097009028,-0.7314617548376581,-0.6204005864775302,-0.5113223104766456,-0.5934726759293577,-0.5792066836556866,-0.6537543284126112,-0.521639696088781,-0.4217241593273932,-0.3979041062368499,-0.2910277507741779,-0.31653094056435865,-0.31271284702420393,-0.17190558801564598,-0.08957899475552873,-0.11081953284203906,-0.03474752513145364,-0.04273803850366873,-0.0945893286133175,-0.1092083831681716,-0.12328859725937506,-0.06884955708624804,-0.13204973448411933,-0.11285135007265497,-0.07342209572558546,-0.049653764389375445,-0.0060185542033113016,-0.012304230728715539,-0.03033137379449479,-0.0870801042477328,-0.051060493077810236,-0.09716156027806523,-0.09360847231298426,-0.021409110896949923,-0.019288562768526724,0.007279694880883179,0.03109176933235884,-0.003474912649559697,-0.04721441894953761,-0.10420688295944645,-0.125111532527651,-0.09964011781834058,-0.04368686304991073,0.03676178269467669,0.05320726680489388,-0.008322872148846333,0.0004626952428059367,-0.05966731863952908,-0.02806186225476696,0.0006996696958790644,0.0499386946349669,0.010813660107911276,-0.10732982981505824,-0.07139805397409209,-0.03921355006813629,0.009009420496005904,0.04099931120320911,0.0533418627986692,0.04253126040500153,0.06528986415156832,0.12228021356375059,0.15960670518015266,0.08372372982390724,0.006459690350206255,-0.01248786932106023,-0.03834896874779947,-0.05952857894653085,0.053137210651987336,0.19349836556919017,0.22723686795141687,0.24964362126010337,0.2992181947533352,0.2381853832373865,0.19781302925700686,0.28022986254133786,0.3639440049886739,0.49112866767507135,0.5565064194523442,0.4971357212400718,0.5076265238262139,0.39526762926183945,0.4302844776044973,0.420920889576361,0.24457877925128055,0.3038077879672332,0.32222883179434625,0.25225644609122055,0.2568586127366754,0.20205183857510467,0.09981149233248898,0.0417714935272594,0.0062164296319931565,-0.0026660564471514417,-0.11045485805656419,-0.09330518453446485,-0.1587807412988783,-0.12993409946838858,-0.2026265286213503,-0.2063194394120462,-0.31707495356896587,-0.3403044524109259,-0.265826726532376,-0.19467392586686375,-0.16763208606312263,-0.14764206352537496,-0.1261193812417531,-0.18396465488624775,-0.22590975411768877,-0.21706701333731385,-0.21283676080538105,-0.21546658386430362,-0.08517473296156217,-0.08397857457485829,-0.13418613751963562,-0.05665777656248427,-0.07465324024351906,-0.13348389243725253,-0.09047546847970046,-0.13089797866537128,-0.09940726543960572,-0.06422951178995304,-0.0183392833127454,-0.034132980967429546,-0.04899011572392867,-0.07714720444608565,-0.034806863601023204,-0.0036635745412776674,0.04104779263684857,0.17397405437771551,0.13982274977378295,0.12929718007609436,0.09876263748471063,0.15922211203792347,0.13467759741167148,0.22383216375027315,0.1979909654357368,0.11584274350362314,0.07906774074656625,0.04910099981924296,0.07243153259127154,0.15866013056379824,0.21790653548589348,0.1885144732949406,0.14468973309333996,0.1434233441888209,0.11986729568546982,0.12069912078827504,0.14754531005514557,0.12537936618606216,0.07824040393489273,0.03002179938779635,0.04691833235224311,0.11799843610447355,0.13349212787458392,0.13769867227876095,0.06570222177168468,0.004411043695357046,0.022185028996251445,0.05632013926878469,0.09660843944969981,0.05588614213808933,0.08687527540898023,0.08446574132485458,0.055869771369153526,0.08958807233859105,0.12736331740082135,0.10496382552344409,0.09363805469945743,0.12073110636487282,0.10251106935323907,0.12845001542087275,0.09530932141155367,0.08841208863965656,0.07360950909181198,0.016579778502115478,0.05295423517404667,0.03775772562229324,-0.05948607447573818,-0.033710439406407756,-0.12696922558748996,-0.18556698399853322,-0.14777207051102406,-0.11829639416817876,-0.10505225517105886,-0.10580937485698443,-0.11902829033593568,-0.18590457054145199,-0.16372228077976095,-0.14451746495596246,-0.2051457902142508,-0.23681031387588988,-0.19956336667472077,-0.22209970867216974,-0.2604512730907799,-0.14804503283276096,-0.2150785840348491,-0.3158319017516044,-0.38116548201725736,-0.5689272105584645,-0.5847831111829568,-0.5751353677338458,-0.500156432972491,-0.39664595297149174,-0.45475007000560824,-0.5023131146191033,-0.38255917462731104,-0.4236700385105359,-0.31460264060738413,-0.25817513743218723,-0.2585905323982139,-0.2789251410797532,-0.21963815819575372,-0.13983523073193813,-0.2369755261802437,-0.3702084193225819,-0.3832381680387749,-0.4799176789569016,-0.4441561225257615,-0.40939364893859637,-0.46815813365676656,-0.5552565263315307,-0.5072659280785692,-0.36607537825925524,-0.3128593692372146,-0.2675406064663319,-0.29817290034015065,-0.262713241650532,-0.37034881309143364,-0.37026025084001496,-0.23263067691332576,-0.21960495726378346,-0.2016980519568507,-0.13356584501511912,-0.16182152035984548,-0.23083254913478007,-0.2612086186715561,-0.17785178876595845,-0.16204894994589344,-0.19624042102516573,-0.2455958811454021,-0.3645077265058055,-0.4400169920545628,-0.14408617015745728,0.16769559556226551,0.3127029278146002,0.43978069662450064,0.5512882917153272,0.5049687081289347,0.6371115968639754,0.8837895366172129,0.8507235087688723,0.8655510124850057,0.8994373590387937,0.9417887178737774,1.0334615721866647,1.3108563485739522,1.5312729113156933,1.5894371674225023,1.555152667117897,1.3814448306047704,1.4699170529136871,1.4666994640344944,1.474916884203047,1.7009689132855155,1.722113475457655,1.6649871047069627,1.7429206943880402,1.698197736218993,1.7506638412359474,1.8002069733760722,1.9066967539838702,1.7530361498029323,1.6046021992158872,1.6264410620731897,1.5225036119152733,1.4850687065989632,1.5194658496275182,1.4204652974723702,1.2294414501432445,1.0640813740820574,1.105050022876978,1.055044951743642,1.0003309095173738,1.1307833880272062,0.87242358542471,0.6540545927154989,0.6493880342168892,0.5927718682305813,0.5685007611774773,0.6799592305639296,0.5829064831129112,0.4728826313026144,0.38264439982724696,0.4152857377993175,0.4203040851357362,0.4085962251138678,0.3697279991656144,0.33457314427059276,0.453827646634988,0.47495521627731563,0.5660460991860418,0.6195722176878503,0.4336258464598802,0.525008148712267,0.46535078967153914,0.4076486613962112,0.43271468623792236,0.4798885057153919,0.40897692192435187,0.40819096134817445,0.38039119326829535,0.3502385641426267,0.2380427920279228,0.19696241694027475,0.20225392115478386,0.0517039308760396,-0.014561776828778404,-0.028892391479576698,-0.10912786319313506,-0.1334608775168204,-0.0008477394029007247,-0.17591918040589194,-0.22297423605921646,-0.19816122885104934,-0.2512577635524543,-0.1695108510102972,-0.13829724238334437,-0.032902426222236776,-0.02044149498621839,0.08388775619405049,0.1035019399102949,0.11423278961911447,0.11672182076196141,0.11055758040382803,0.0916265813886798,0.13142210849419708,0.16237346236912548,0.2603195895411105,0.33576963630864404,0.3119314224435227,0.34705204883013535,0.3483446187339445,0.3249590859906624,0.30178323530839146,0.22406885674931692,0.10264829692059393,0.06546113360491752,0.04165746487957454,0.0396540370978029,0.09505801696173655,0.052121105992377854,0.0629778152399668,0.04510825840469946,0.1754627417095653,0.1622714290898659,0.03607509001226791,-0.026131312413007344,-0.08127169254405037,-0.12370402815230762,-0.11902428393722922,-0.1077604818273511,-0.17996680857715378,-0.21169481025435874,-0.2261803409981276,-0.19397675557028632,-0.23343746860080666,-0.20092513117945207,-0.20177769316248634,-0.25362316365286547,-0.14252504387672157,-0.07224780044771796,-0.019668869851477637,-0.03776379074154636,-0.055623836966541655,-0.10639139127990274,-0.1562657992336846,-0.16847549802661463,-0.19746718544195122,-0.14028508540175508,-0.10456753881838357,-0.10779384280248869,-0.043327499698828,-0.061446723678661226,-0.04638442744408421,0.022773033335891493,0.02096885954664343,-0.08718842474797847,-0.09839653008248798,-0.13660387373935082,-0.1683324654460127,-0.044756290954462825,-0.008673508178325212,0.013058469774973346,0.0047811382678446465,-0.043037048435272514,-0.08119985967957094,-0.08661516223365302,-0.0746372783670395,-0.0811456288973329,-0.10015149371413574,-0.13346586623797244,-0.1434363366987993,-0.17025797934116318,-0.2449083114008813,-0.1740289546244326,-0.18844499549126356,-0.18464182655615594,-0.151900484779953,-0.09192130061237051,-0.10275091097779555,-0.044539307931016625,-0.052715060500655546,-0.049291078282333596,-0.040317842555055924,-0.03551897591160371,0.010080573897732741,-0.002552393368827914,0.020543797513354743,0.00788184449337932,0.005221395034957622,-0.05975121013201219,-0.024648346810931542,-0.02455708921603468,-0.07390961273639958,-0.11824577362683572,-0.1666967136864098,-0.15118195542397941,-0.1878340492692039,-0.14428449465216625,-0.11023373510037988,-0.11723231694743162,-0.09439654698235986,-0.08144718922479437,-0.055901100173607006,0.013775420673886981,0.012537838287365951,0.03521715292230997,0.04484510222599895,0.062030964514782266,0.1429696131051485,0.11035276950721064,0.08697074922294316,0.07799762303231594,-0.010686151146389468,-0.05235085030676439,-0.01329447843743248,-0.08719422230981999,-0.06744680068592203,-0.045976620400902,-0.08482010905180327,-0.1028066474605374,-0.09344053377168765,-0.03170632208348414,-0.0716000294718869,0.01581512756262181,0.09062928698886988,0.060034840004415335,0.06630851376749991,0.07082701973385881,-0.016000276727483085,-0.01585896532778982,0.051694197021771575,-0.03143773256724119,-0.05690309593975283,-0.005720358264215116,-0.08216816193938975,-0.050870973056439416,-0.0742625087241533,-0.04684534535878085,-0.06039574830746472,-0.06858497653945156,-0.034572959254980405,-0.08752278594283786,-0.1792549528295088,-0.24054042387521868,-0.2984251692038874,-0.2674673770200525,-0.04689644325045654,0.054108063799391294,-0.01593010090268257,-0.10218064683489907,-0.17363846644151157,-0.41799732946943613,-0.6026409809527299,-0.6657553775853161,-0.6362820170922676,-0.4769938572041534,-0.34658988573699523,-0.379349731335031,-0.3817282685113261,-0.5292957854897902,-0.6217298509407404,-0.577758089016694,-0.5270502447401897,-0.4973478084805726,-0.4548798621691452,-0.4182019248899512,-0.5070916876238913,-0.5046546954568982,-0.45512460030306207,-0.4227692295277471,-0.4657645162910649,-0.383635389330816,-0.3908158710884628,-0.4607341989856151,-0.40981450600927966,-0.3883187889769152,-0.4401953865499009,-0.46632574397845095,-0.3993980055304878,-0.44519631404621124,-0.413296222813246,-0.34584217117214167,-0.2851455083188987,-0.3556018358669031,-0.2850094961226785,-0.2517728508879225,-0.3571197842581918,-0.29176321461814275,-0.22033156112551994,-0.24893869724670517,-0.2413462742553716,-0.1644800158612341,-0.2106235484480847,-0.17997644541493432,-0.2000619223879069,-0.2106289822235868,-0.25420007277899,-0.2352791883029314,-0.22371994495719827,-0.2674159118108735,-0.29281563969491975,-0.3377986644173012,-0.28081689154852535,-0.2985642790924615,-0.25234329859756177,-0.21382261281061649,-0.23436964236489513,-0.22407058629002902,-0.24917519080887005,-0.19064300577614912,-0.14877613401396028,-0.11500707066130844,-0.09695704879684568,-0.0925861774846256,-0.10583700428439176,-0.05736964775095814,-0.04687076970832153,-0.06912597470900805,-0.11102392410214214,-0.03929663207020828,-0.08177075119379867,-0.07322897172040282,-0.05698778610991595,-0.09486789829926551,-0.1394769976766893,-0.0906622751768413,-0.09490417215303291,-0.07258837564890183,-0.09555046947021975,-0.16724032184069493,-0.1927967296598399,-0.14510933559942005,-0.14362422865287403,-0.15110261358099336,-0.1604168347818909,-0.12458904019155513,-0.030106096693759996,-0.02204844593894531,-0.0017751917867539818,0.028220810912951894,-0.04166265175310823,-0.0052992538187844095,0.17691390526878706,0.2703687818145332,0.29833451872229017,0.38222904984428197,0.3148381833018753,0.23050093680786307,0.36446334585989887,0.45699323824449384,0.5164544677891678,0.5557708248191426,0.44543849255331613,0.46107446508357586,0.5441837786994379,0.6798698144913558,0.7315650924029913,0.6873184132442832,0.6059371335603451,0.3921982052124914,0.4231502567883755,0.45615734289021376,0.50479969877279,0.48903369625688375,0.3145370850433018,0.3815090578308903,0.39814843912821646,0.40083385058824733,0.49064708381140637,0.5406514922339148,0.47946967050391665,0.4129348330642832,0.378692818053573,0.3308238565614279,0.3082582142604709,0.3447170418112927,0.30695459774937234,0.1575051365754987,0.09509382250888301,-0.006535342512486213,-0.1606599005097623,-0.23479570382692794,-0.2643435381443058,-0.296677844583286,-0.34092871125856655,-0.32087075996636816,-0.27894319265822975,-0.3012367834496431,-0.3199565406710667,-0.31076494434110935,-0.2958533018399927,-0.2795553558626269,-0.137607086853153,-0.11979653448838531,-0.08708158204234923,-0.0685025371258403,-0.10874953809033035,-0.08163048025203858,-0.11709647990655482,-0.06154079387840054,-0.034747524742753284,-0.07211512927605844,-0.08059144743009229,-0.1063163371514744,-0.19254180502163537,-0.1971195104562257,-0.22516171231780419,-0.2832731343147027,-0.24403594592548677,-0.1737238753526478,-0.18723131236445006,-0.15143391119171581,-0.19214160431445282,-0.32071192902882495,-0.4558146294383849,-0.5278743094524846,-0.4793552409597256,-0.31046172097204855,-0.2534038509132042,-0.2328152796433117,-0.24614909989842615,-0.24965507170947235,-0.24855598215841504,-0.1994958232802521,-0.21385471367763362,-0.24981859128629288,-0.2059943401694598,-0.20755652599003746,-0.22719522431771277,-0.1418820952261168,-0.11623584727092186,-0.15781520767927532,-0.022063959705824084,0.022806218169812147,-0.032066146795275835,0.13481897123419592,0.1107885596378435,0.1875419590659218,0.1864876228148994,0.19467979440562003,0.1516533739981168,0.025324322409497665,0.05884362731762758,0.11117016567435523,0.04670090016630218,0.03261043567998446,0.14243577287131587,0.029104851718213615,0.013321591212289537,0.12949245819634733,0.13886491052682115,0.260995102046868,0.2670160122377997,0.24099422986317934,0.18049953435893726,0.23870520594909753,0.2100552830488828,0.18578380390234914,0.17655132109224653,0.18498972329937982,0.18295697083974646,0.20289790671432262,0.1873249732625249,0.19214765429837224,0.07183811022516845,0.03844002155487052,0.03565988903511501,0.0029732572058961226,0.03117861638079596,0.01001341179410194,0.09112000721569295,-0.03472733981323286,-0.06500753202554854,-0.0766067626814929,-0.12844769113620746,-0.07417255451067323,-0.0097493144839627,0.13596296098338045,0.0570438177428047,-0.013939163086729258,-0.061952828357444235,-0.16907103783526564,-0.20883551269062928,-0.14328453243467984,-0.02346716108817631,0.04418997165476039,0.12368224825117059,0.13552336466092546,0.12216859273524149,0.09302573713490611,0.06494000108169093,0.0911336977600168,0.05749816381578984,-0.01842281973547762,-0.0772089255827698,-0.12318273430667893,-0.1659664706083372,-0.24326327594748326,-0.20706207189474662,-0.2018703643718789,-0.2898964311830673,-0.18044580052844134,-0.15756053490594077,-0.179042942510218,-0.12364577355937571,-0.076641949092053,-0.04686930467966302,0.0027229937003107265,0.0032014552967168457,0.09129739981040615,0.1561893746724061,0.27692412619063617,0.43459174973427966,0.22898315744543724,0.1155984520294808,0.09869929148578412,0.06346619620452502,0.18026388362467546,0.4106144580239142,0.4656032066279303,0.48306112309465254,0.4055192495037013,0.3025884580131941,0.29006204871166585,0.3141464644806798,0.33998799471169344,0.33505013109166637,0.2887324738227011,0.19396016013175388,0.13351458168452282,0.13099895717643406,0.18720298941489946,0.20961314756948643,0.14702200866710669,0.10081122709900031,-0.09422363540396314,-0.31119594720475546,-0.2605186080727598,-0.27563463285417567,-0.23188440948350203,0.021010507880922364,-0.05995342692495897,-0.23978556229137998,-0.35567835815403304,-0.4360851178420277,-0.44102522596550486,-0.3866975234134657,-0.34500856373046107,-0.36227884362630847,-0.372430938684837,-0.3928546765956464,-0.36779279961377326,-0.39319165665069455,-0.397990099750885,-0.287268473425612,-0.2850846578358749,-0.3218205260873665,-0.36565830759053797,-0.36380609867928476,-0.3207409558570729,-0.21240589699586873,-0.05241556721535798,-0.10685369292982694,-0.17327019959762,-0.2798798185759332,-0.3878357288328181,-0.2921981405369415,-0.3544406002479399,-0.3148589935543976,-0.24939303061696308,-0.1718647169580721,-0.13440256141848114,-0.1155656885715838,-0.15884053498117437,-0.22086225774744114,-0.2522826529094639,-0.3011604254774497,-0.3104709820784502,-0.3602840613818521,-0.32973810911533175,-0.4272177261383037,-0.5167113623055871,-0.5848375126430302,-0.5584954978368927,-0.4182236917622322,-0.3574713798222982,-0.35393427731729404,-0.3992771303933066,-0.5456446528862378,-0.5740213708087106,-0.38983697428511216,-0.2001572655065033,-0.02201951757900483,-0.06288802549187744,-0.09034489079339877,-0.16523231113650433,-0.06864696152186923,-0.16978227617819572,0.20931756569768187,0.2641313322283606,0.07190531405646926,0.1993458968327628,-0.0223569695550761,-0.26151765528488397,-0.17867978253948089,0.07883746881962109,0.12769482526527035,0.2961440162900481,0.39880340365676015,0.11371196413481888,-0.10904247440161857,-0.12730958469221287,-0.2609536296164606,0.04819142820157926,0.262942207361435,0.14970325936886023,0.13354464614913938,-0.010718167328822836,0.0025424987444891455,0.02683856447074525,0.29947047779806035,0.10015142200581517,-0.16910803876654057,0.018023648983703365,-0.10172339700735987,0.0038831713651805155,0.3159444491986531,0.12832443190828477,-0.19813395946680432,-0.2237766260779792,-0.18138817895362772,-0.37558336481867277,-0.022091975958297632,-0.19393860187485665,-0.2901195543389127,-0.27430080815568203,-0.42118609689330105,-0.18530696589512632,-0.0015282010099881887,0.1469099504408382,-0.1602951717726795,-0.04178911347968315,-0.2624027606027511,-0.5490671436782054,-0.31749535671203427,-0.15790128199026623,-0.28845655092557404,-0.16845858776303685,0.014611694678953005,-0.25851731678001566,-0.2823948276507427,-0.0670836205462527,-0.027488517990475025,0.1822306352784788,0.2845170457545591,0.27191750209469834,0.21530639611556698,0.30767327168569875,0.36297509698016933,0.35291846072238064,0.4969540890086276,0.2199406296713482,0.34918404915325535,0.5006195573095823,0.5970685418675513,0.6565025079306908,0.6464190935734794,0.49904111057735073,0.5519712010714525,0.712457142149062,0.7189641386762481,-0.2995198992520872}; 

void loop() {

    float y_pred[2] = {0,0};
    int j = 0;

    for (j=0; j < 1; j=j+1)
    {

      tf.predict(x_test, y_pred);

      Serial.print("Predicted proba are: ");

      for (int i = 0; i < 2; i++) {
          Serial.print(y_pred[i]);
          Serial.print(i == 1 ? '\n' : ',');
      }

      delay(1000);
    }
}

Actually, I don't change the .ion code, and only change the model code in keras python environment. But in Arduino serial monitor Conv2D and Dense doesn't work, fully Dense works.

I guess it's the problem of input data stucture? or the TENSOR_ARENA_SIZE because of my data size? or the library version?

whubaichuan commented 2 years ago

@eloquentarduino solved the problem. We should be careful about the SRAM limitation and TENSOR_ARENA_SIZE.