Tensorflow突触输出和输入为文本文件

时间:2019-02-26 10:41:20

标签: python numpy tensorflow yolo

我有一个带有tensorflow的对象检测输出结果。 这是一个13 * 13 * 125 float32数组。 (tiny-yolo-v2) 我可以将其与文本文件一起输出。

现在,我想编写另一个程序来解析文本文件。 如何使用numpy或其他方式将文本文件加载回数组?

我只想加载文本文件,并放置在正确的位置, 就像它是原始的(13 * 13 * 125)数组一样,所以我可以使用它来做点什么。 以下是文本输出的示例,完整文件太长,因此我将其截断了一部分。

[[[ 1.02357492e-02 -4.58745286e-02 -3.53223026e-01  1.05358012e-01
   -4.35989094e+00 -6.99408484e+00 -4.73687983e+00 -4.24568987e+00
   -5.61564398e+00 -2.89398456e+00 -6.23602247e+00 -1.50982809e+00
   -5.22811985e+00 -2.62615561e+00 -5.22997189e+00 -7.89167452e+00
   -5.44317961e+00 -6.20110512e+00 -5.04192924e+00 -2.02722573e+00
   -4.10300493e+00 -6.34364843e+00 -5.39359808e+00 -8.28967571e+00
   -5.09567547e+00  7.58925438e-01  3.76614660e-01 -1.04403806e+00
   -6.47649229e-01 -3.87396884e+00 -6.38732052e+00 -4.58577824e+00
   -4.16016054e+00 -5.30572081e+00 -3.85717177e+00 -6.05014038e+00
   -1.81165671e+00 -3.75763679e+00 -2.88092995e+00 -4.67342377e+00
   -4.71987104e+00 -4.39510489e+00 -5.11723280e+00 -5.39322329e+00
   -2.66565347e+00 -3.81883574e+00 -5.66908169e+00 -4.71839476e+00
   -6.30157852e+00 -4.82082224e+00  2.92960078e-01  5.97341239e-01
   -1.40992713e+00 -1.11044288e+00 -4.18370819e+00 -7.12151051e+00
   -5.35866928e+00 -4.90489340e+00 -5.99866199e+00 -5.80428791e+00
   -6.52985144e+00 -3.30560398e+00 -5.25323820e+00 -3.49718428e+00
   -5.35445309e+00 -4.74132204e+00 -5.51197958e+00 -5.49749136e+00
   -5.92978096e+00 -3.28844571e+00 -5.49212742e+00 -6.66666460e+00
   -4.93477535e+00 -7.05240107e+00 -5.52950144e+00  3.19003403e-01
    4.28509444e-01 -1.37157345e+00 -7.52444148e-01 -5.07417107e+00
   -6.86192179e+00 -5.41829157e+00 -4.65392542e+00 -6.23983860e+00
   -5.52950287e+00 -5.39464998e+00 -3.28175688e+00 -4.32805681e+00
   -3.33854008e+00 -5.02955580e+00 -5.26897430e+00 -4.58855247e+00
   -5.45577812e+00 -7.06963253e+00 -3.20757794e+00 -4.94750690e+00
   -6.26993036e+00 -5.85515499e+00 -7.07721949e+00 -5.31591606e+00
    3.89474362e-01  3.98911506e-01 -1.40775967e+00 -1.07488203e+00
   -3.43887043e+00 -7.79423666e+00 -6.68394804e+00 -5.61368179e+00
   -6.34769297e+00 -6.83281803e+00 -6.70960665e+00 -3.65747070e+00
   -5.44360542e+00 -4.12546444e+00 -5.75262260e+00 -5.18836164e+00
   -5.15945435e+00 -6.07800007e+00 -6.70447493e+00 -4.12499619e+00
   -6.12767649e+00 -6.96556044e+00 -4.83318233e+00 -7.69717407e+00
   -6.56721640e+00]
  [ 1.61234528e-01 -4.70345289e-01  2.98500329e-01  8.74740630e-03
   -8.38169765e+00 -1.54907408e+01 -1.07314129e+01 -8.34741211e+00
   -1.13781738e+01 -7.54940701e+00 -1.22155275e+01 -4.80996466e+00
   -1.10561914e+01 -5.93502522e+00 -1.11998129e+01 -1.67726002e+01
   -1.05111227e+01 -1.29506483e+01 -9.64104748e+00 -5.52446413e+00
   -8.78175163e+00 -1.36118546e+01 -1.10795031e+01 -1.83356972e+01
   -1.16452293e+01  4.82036829e-01  5.17037362e-02 -9.76964355e-01
   -1.00542104e+00 -8.73878384e+00 -1.47731256e+01 -9.41302872e+00
   -7.78294754e+00 -1.06155653e+01 -8.81066895e+00 -1.25413752e+01
   -5.20565796e+00 -8.54619980e+00 -6.01115370e+00 -1.01015797e+01
   -9.61278534e+00 -8.36357498e+00 -1.08267517e+01 -1.04049816e+01
   -5.86520195e+00 -7.45389271e+00 -1.18097382e+01 -9.29529381e+00
   -1.35695248e+01 -1.10684004e+01 -4.49465424e-01  7.23291993e-01
   -1.33733368e+00 -1.57884443e+00 -9.29384422e+00 -1.66824398e+01
   -1.17275839e+01 -1.19206190e+01 -1.26649590e+01 -1.42257290e+01
   -1.43436852e+01 -9.10658264e+00 -1.34929924e+01 -8.85398579e+00
   -1.30774622e+01 -9.42021656e+00 -1.28294401e+01 -1.38840723e+01
   -1.24558411e+01 -8.84429169e+00 -1.17602949e+01 -1.50427999e+01
   -1.07627420e+01 -1.64452419e+01 -1.44604845e+01 -1.37743965e-01
    9.12959814e-01 -1.42015231e+00 -1.60620236e+00 -1.05381451e+01
   -1.63558159e+01 -1.20377207e+01 -9.80946445e+00 -1.27067585e+01
   -1.21898088e+01 -1.22341051e+01 -7.98180962e+00 -1.05312557e+01
   -7.84510660e+00 -1.18309231e+01 -1.10772572e+01 -9.54380226e+00
   -1.25601234e+01 -1.43880062e+01 -6.95701408e+00 -1.07601147e+01
   -1.41597824e+01 -1.32586575e+01 -1.58946438e+01 -1.29948921e+01
   -1.14585623e-01  6.38350546e-01 -1.65523076e+00 -1.67830050e+00
   -6.13089418e+00 -1.99999962e+01 -1.58348789e+01 -1.47631931e+01
   -1.50945425e+01 -1.69028625e+01 -1.67195797e+01 -1.10481138e+01
   -1.45758791e+01 -1.19301071e+01 -1.46967478e+01 -1.34157457e+01
   -1.31685534e+01 -1.52268438e+01 -1.63326721e+01 -1.15273895e+01
   -1.43742008e+01 -1.75251045e+01 -1.33377829e+01 -1.88240013e+01
   -1.68392487e+01]
  [ 7.36066699e-01 -3.97309035e-01  3.82082105e-01 -4.82245922e-01
   -1.08697920e+01 -2.12837963e+01 -1.57861137e+01 -1.22496452e+01
   -1.57928638e+01 -1.18547354e+01 -1.80118999e+01 -7.86523342e+00
   -1.56991911e+01 -1.01874857e+01 -1.54575453e+01 -2.39257183e+01
   -1.58380346e+01 -1.81504345e+01 -1.34132137e+01 -8.03548622e+00
   -1.13906355e+01 -1.92472000e+01 -1.61356659e+01 -2.55897179e+01
   -1.63397522e+01  1.27788866e+00  1.47072300e-01 -1.28866732e+00
   -1.59696829e+00 -1.16580629e+01 -2.02393227e+01 -1.35793419e+01
   -1.12705021e+01 -1.47425270e+01 -1.25504894e+01 -1.83755665e+01
   -7.93362045e+00 -1.18984699e+01 -9.53976822e+00 -1.38737183e+01
   -1.44854469e+01 -1.36983585e+01 -1.51859636e+01 -1.39583693e+01
   -7.84845734e+00 -8.99971676e+00 -1.61694489e+01 -1.35863504e+01
   -1.87846413e+01 -1.51690617e+01 -2.49404103e-01  7.78339028e-01
   -1.56386018e+00 -1.99905097e+00 -1.37179251e+01 -2.25832596e+01
   -1.66161022e+01 -1.74464626e+01 -1.75472069e+01 -1.98302021e+01
   -2.10891953e+01 -1.31870728e+01 -1.92208481e+01 -1.34429426e+01
   -1.86840858e+01 -1.41525555e+01 -1.94452248e+01 -1.92487373e+01
   -1.68426666e+01 -1.22350378e+01 -1.52343149e+01 -2.06815968e+01
   -1.60188885e+01 -2.32096100e+01 -2.02435265e+01 -4.40291494e-01
    9.96976972e-01 -1.84825552e+00 -2.43193603e+00 -1.60602741e+01
   -2.19036083e+01 -1.68400517e+01 -1.44771357e+01 -1.67081776e+01
   -1.65251980e+01 -1.87576752e+01 -1.10540638e+01 -1.53755598e+01
   -1.19390879e+01 -1.68008995e+01 -1.63949070e+01 -1.50700588e+01
   -1.70634537e+01 -1.89655972e+01 -8.94600296e+00 -1.35194263e+01
   -1.92807941e+01 -1.87041073e+01 -2.21856689e+01 -1.78996506e+01
   -1.16609700e-01  8.56797874e-01 -1.91140997e+00 -2.10396862e+00
   -1.01619406e+01 -2.68737984e+01 -2.20997658e+01 -2.17673626e+01
   -2.05160961e+01 -2.39515285e+01 -2.49530716e+01 -1.63933392e+01
   -2.10805988e+01 -1.75326271e+01 -2.07077827e+01 -2.00489578e+01
   -1.99268951e+01 -2.12444305e+01 -2.24091759e+01 -1.62087784e+01
   -1.91759224e+01 -2.42828751e+01 -1.97305717e+01 -2.62558804e+01
   -2.35940552e+01]
  [ 1.64787069e-01 -1.68441325e-01  4.64288980e-01 -7.47514069e-01
   -1.13719883e+01 -2.10964813e+01 -1.58254576e+01 -1.20305328e+01
   -1.56141787e+01 -1.24658909e+01 -1.81972294e+01 -8.23118114e+00
   -1.59399385e+01 -1.12004852e+01 -1.55562868e+01 -2.40003681e+01
   -1.60093613e+01 -1.83026943e+01 -1.34068794e+01 -6.93028069e+00
   -1.03299189e+01 -1.94805012e+01 -1.63801708e+01 -2.56201134e+01
   -1.63976402e+01  1.10720372e+00  1.62255913e-01 -1.05587530e+00
   -1.77236927e+00 -1.20724707e+01 -2.02502041e+01 -1.33943348e+01
   -1.08683929e+01 -1.41024590e+01 -1.30132847e+01 -1.84846783e+01
   -7.94123554e+00 -1.22969742e+01 -1.03535299e+01 -1.35685444e+01
   -1.45834017e+01 -1.35028725e+01 -1.57420397e+01 -1.32303410e+01
   -6.45265770e+00 -7.93988371e+00 -1.61845226e+01 -1.36617155e+01
   -1.87895412e+01 -1.55598927e+01 -1.80259988e-01  1.03606677e+00
   -1.41069508e+00 -2.04342628e+00 -1.45336590e+01 -2.16282444e+01
   -1.64379387e+01 -1.69099007e+01 -1.71524391e+01 -2.03189278e+01
   -2.16217175e+01 -1.30156775e+01 -1.94296246e+01 -1.43709736e+01
   -1.84245052e+01 -1.49390011e+01 -1.87584820e+01 -1.90721817e+01
   -1.62022648e+01 -1.08158903e+01 -1.40190802e+01 -2.06927853e+01
   -1.63408413e+01 -2.31514969e+01 -2.11648083e+01 -5.68280160e-01
    1.25197387e+00 -1.61449420e+00 -2.57362318e+00 -1.61436348e+01
   -2.13765507e+01 -1.67169514e+01 -1.40701723e+01 -1.61057911e+01
   -1.66000061e+01 -1.96425610e+01 -1.07086115e+01 -1.61478901e+01
   -1.29794235e+01 -1.68822880e+01 -1.73082714e+01 -1.47676716e+01
   -1.75105286e+01 -1.80940990e+01 -7.51458597e+00 -1.21162443e+01
   -1.94071865e+01 -1.87942944e+01 -2.22906494e+01 -1.84283085e+01
    1.27930269e-01  1.27133667e+00 -1.74558055e+00 -2.15854144e+00
   -1.09730215e+01 -2.62110558e+01 -2.23466148e+01 -2.14312553e+01
   -1.95770702e+01 -2.44276924e+01 -2.58058815e+01 -1.61417542e+01
   -2.14367542e+01 -1.83109913e+01 -2.04648132e+01 -2.08876133e+01
   -1.97048931e+01 -2.15082779e+01 -2.18297424e+01 -1.52893324e+01
   -1.85209503e+01 -2.46299267e+01 -1.97363987e+01 -2.58215981e+01
   -2.42690868e+01]
    .
    .
    .
  [-4.79533195e-01 -7.68981576e-01 -1.77157074e-01 -2.00561881e-01
   -6.15729952e+00 -1.10808945e+01 -8.79792976e+00 -9.85613537e+00
   -1.03026905e+01 -6.87720442e+00 -1.21334057e+01 -7.71150637e+00
   -1.17531910e+01 -6.80997133e+00 -1.25995235e+01 -1.25998411e+01
   -1.17608614e+01 -1.11489801e+01 -9.56524754e+00 -5.58242607e+00
   -8.39977741e+00 -1.11510391e+01 -1.21788979e+01 -1.27471313e+01
   -9.78714943e+00  1.04039955e+00 -1.47011960e+00 -1.81243956e+00
   -1.05356848e+00 -7.45137024e+00 -1.10531626e+01 -7.84224939e+00
   -9.17456150e+00 -8.58650589e+00 -5.74499321e+00 -1.13209743e+01
   -8.41722298e+00 -1.01030149e+01 -6.03559208e+00 -1.16964493e+01
   -1.01863642e+01 -1.12248173e+01 -1.11838684e+01 -8.50443459e+00
   -5.21056652e+00 -8.14196777e+00 -1.00152636e+01 -1.10866699e+01
   -1.11966391e+01 -9.41972065e+00 -1.03180420e+00 -1.99524832e+00
   -1.77945817e+00 -1.55166841e+00 -8.39315605e+00 -1.05041189e+01
   -8.82065392e+00 -9.86864853e+00 -9.29331779e+00 -7.26610661e+00
   -1.02731133e+01 -8.88734341e+00 -1.01116686e+01 -7.06797981e+00
   -1.14280262e+01 -1.06731510e+01 -1.14312458e+01 -1.05220804e+01
   -9.01323318e+00 -5.39441586e+00 -8.52228928e+00 -9.87894917e+00
   -1.08900566e+01 -1.09518299e+01 -9.72581577e+00 -2.16618586e+00
   -1.49259973e+00 -1.68929064e+00 -1.36120069e+00 -8.58770275e+00
   -1.00534191e+01 -9.97209167e+00 -1.05166273e+01 -9.29751587e+00
   -7.26231098e+00 -1.13336391e+01 -9.37137890e+00 -1.04662256e+01
   -7.50347424e+00 -1.16567268e+01 -1.01384783e+01 -1.12277622e+01
   -1.08337603e+01 -9.39500999e+00 -6.51295757e+00 -9.02511883e+00
   -1.06069736e+01 -1.13605204e+01 -1.08889675e+01 -9.81694508e+00
   -1.06967080e+00 -1.58631933e+00 -1.36870170e+00 -1.17178059e+00
   -7.71994257e+00 -9.72991562e+00 -9.93029594e+00 -1.08334541e+01
   -9.51464462e+00 -9.31674480e+00 -1.08087626e+01 -9.48193550e+00
   -9.81091881e+00 -8.34595966e+00 -1.10064735e+01 -9.91674614e+00
   -1.18921404e+01 -1.08112535e+01 -9.73410416e+00 -7.14041519e+00
   -8.62492752e+00 -1.10488844e+01 -1.03341990e+01 -1.04487247e+01
   -1.07167931e+01]]]

我尝试使用以下格式,它可以读出某些内容,但是顺序完全错误

net_out = np.fromfile(filename, np.float32, count=13*13*125).reshape(13,13,125)

0 个答案:

没有答案