add audio2mesh_ar
This commit is contained in:
1 parent
ded9b27f71
commit
e0f24982d1
46 files changed
+3917
-325
No files matched your search
+67
-20
@@ -486,42 +486,89 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 97,
|
||||
"execution_count": 112,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def interpolate_features(features, input_rate, output_rate, output_len=None):\n",
|
||||
" num_features = features.shape[1]\n",
|
||||
" input_len = features.shape[0]\n",
|
||||
" \n",
|
||||
" seq_len = input_len / float(input_rate)\n",
|
||||
" if output_len is None:\n",
|
||||
" output_len = int(seq_len * output_rate)\n",
|
||||
" \n",
|
||||
" input_timestamps = np.arange(input_len) / float(input_rate)\n",
|
||||
" output_timestamps = np.arange(output_len) / float(output_rate)\n",
|
||||
" output_features = np.zeros((output_len, num_features))\n",
|
||||
" \n",
|
||||
" for feat in range(num_features):\n",
|
||||
" output_features[:, feat] = np.interp(output_timestamps,\n",
|
||||
" input_timestamps,\n",
|
||||
" features[:, feat])\n",
|
||||
" return output_features\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"from scipy import interpolate\n",
|
||||
"def convert_fps(y, source_fps = 30, target_fps=25):\n",
|
||||
" \"\"\" \n",
|
||||
" y, (nframes x nc_feat) (with source_fps)\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" nsteps = y.shape[0]\n",
|
||||
" x = np.arange(0, nsteps, 1)\n",
|
||||
" # print(\"x:\", x[::30], x[-10:])\n",
|
||||
" func = interpolate.interp1d(x, y=y, axis=0)\n",
|
||||
"\n",
|
||||
" x_new = np.arange(0, nsteps-1, 1.0*source_fps/target_fps)\n",
|
||||
" # print(\"x_new\", x_new[::30], x_new[-10:])\n",
|
||||
" y_new = func(x_new)\n",
|
||||
"\n",
|
||||
" if source_fps < target_fps:\n",
|
||||
" y_new = np.concatenate([y_new, y[-1:]])\n",
|
||||
"\n",
|
||||
" return y_new\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 119,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 65794, 65795, 65805, 65797, 65798, 65799, 65800, 65801, 65802, 65803, 65804, 65806, 65807, 65808, 65809, 65810, 65811, 65812, 65813, 65814, 65815, 65816, 65817, 65818, 65819, 65820, 65821, 65822, 65823, 65824, 65825, 65826, 65827, 65828, 65829, 65830, 65831, 65832, 65833, 65834, 65835, 65836, 65837, 65838, 65839, 65840, 65841, 65842, 65843, 65844, 65845, 65846, 65847, 65848, 65849, 65850, 65851, 65852, 65853, 65854, 65855, 65856, 65857, 65858, 65859, 65860, 65861, 65862, 65863, 65864, 65865, 65866, 65867, 65868, 65869, 65870, 65871, 65872, 65873, 65874, 65875, 65876, 65877, 65878, 65879, 65880, 65881, 65882, 65883, 65884, 65885, 65886, 65887, 65888, 65889, 65890, 65891, 65892, 65893, 65894, 65895, 65896, 65897, 65898, 65899, 65900, 65901, 65902, 65903, 65904, 65905, 65906, 65907, 65908, 65909, 65910, 65911, 65912, 65913, 65914, 65915, 65916, 65917, 65918, 65919, 65920, 65921, 65922, 65923, 65924, 65925, 65926, 65927, 65928, 65929, 65930, 65931, 65932, 65933, 65934, 65935, 65936, 65937, 65938, 65939, 65940, 65941, 65942, 65943, 65944, 65945, 65946, 65947, 65948, 65957, 65949, 65950, 65951, 65952, 65953, 65954, 65955, 65956, 65958, 65959, 65960, 66248, 66249, 66250, 66251, 66252, 66253, 66254, 66255, 66256, 66257, 66258, 66259, 66260, 66261, 66262, 66263, 66264, 66265, 66266, 66267, 66268, 66269, 66270, 66271, 66272, 66273, 66274, 66275, 66276, 66277, 66278, 66279, 66280, 66281, 66282, 66283, 66284, 66285, 66286, 66287, 66288, 66289, 66290, 66291, 66292, 66293, 66294, 66295, 66296, 66297, 66298, 66299, 66300, 66301, 66302, 66303, 66304, 66305, 66306, 66307, 66308, 66309, 66310, 66311, 66312, 66313, 66314, 66315, 66316, 66317, 66318, 66319, 66320, 66321, 66322, 66323, 66324, 66325, 66326, 66327, 66328, 66329, 66330, 66331, 66332, 66333, 66334, 66335, 66336, 66337, 66338, 66339, 66340, 66341, 66342, 66343, 66344, 66345, 66346, 66347, 66348, 66349, 66350, 66351, 66352, 66353, 66354, 66355, 66356, 66357, 66358, 66359, 66360, 66361, 66362, 66363, 66364, 66365, 66366, 66367, 66368, 66369, 66370, 66371, 66372, 66373, 66374, 66375, 66376, 66377, 66378, 66379, 66380, 66381, 66382, 66383, 66384, 66385, 66386, 66387, 66388, 66389, 66390, 66391, 66392, 66393, 66394, 66395, 66396, 66397, 66398, 66399, 66400, 26250, 26251, 26252, 26253, 26254, 26255, 26256, 26257, 26258, 26259, 26260, 26261, 26262, 26263, 26264, 26265, 26266, 26267, 26268, 66630, 66631, 66632, 66633, 66634, 66635, 66636, 66637, 66638, 66639, 66640, 66641, 66642, 66643, 66644, 66645, 66646, 66647, 66648, 66649, 66650, 66651, 66652, 66653, 66654, 66655, 66656, 66657, 66658, 66659, 66660, 66661, 66662, 66663, 66664, 66665, 66666, 66667, 66668, 66669, 66670, 66671, 66672, 66673, 66674, 66675, 66676, 66677, 66678, 66679, 66680, 66681, 66682, 66683, 66684, 66685, 66686, 66687, 66688, 66689, 66690, 66691, 66692, 66693, 66694, 66695, 66696, 66697, 66698, 66699, 66700, 66701, 66702, 66703, 66704, 66705, 66706, 66707, 66708, 66709, 66710, 66711, 66712, 66713, 66714, 66715, 66716, 66717, 66718, 66719, 66720, 66721, 66722, 66723, 66724, 66725, 66726, 66727, 66728, 66729, 66730, 66731, 66732, 66733, 66734, 66735, 66736, 66737, 66738, 66739, 66740, 66741, 66742, 66743, 66744, 66745, 66746, 66747, 66748, 66749, 66750, 66751, 66752, 66753, 66754, 66755, 66756, 66757, 66758, 66759, 66760, 66761, 66762, 66763, 66764, 66765, 66766, 66767, 66768, 66769, 66770, 66771, 66772, 66773, 66774, 66775, 66776, 66777, 66778, 66779, 66780, 66781, 66782, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 138Line truncated
|
||||
"idx_filter len=24171/ total len=129700, percents = 18.636083269082498 %\n",
|
||||
"remain idx len=105529/ total len=129700, percents = 81.3639167309175 %\n"
|
||||
"(12800, 5023, 3)\n",
|
||||
"(7673, 5023, 3)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n"
|
||||
"path_data1 = \"../experiments/audio2mesh/infer_audio2mesh_EN_20220208/20220303-14H18M22S/obama_train_infer_20220217-17H36M22S_epoch_115.npy\"\n",
|
||||
"path_data1_save = \"../experiments/audio2mesh/infer_audio2mesh_EN_20220208/20220303-14H18M22S/obama_train_infer_20220217-17H36M22S_epoch_115_29_97fps.npy\"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"data1 = np.load(path_data1)\n",
|
||||
"data1.shape\n",
|
||||
"\n",
|
||||
"data1 = data1.reshape(12800, 5023, 3)\n",
|
||||
"print(data1.shape)\n",
|
||||
"\n",
|
||||
"data2 = convert_fps(data1, source_fps=50, target_fps=29.97265625)\n",
|
||||
"print(data2.shape)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"execution_count": 118,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"array([0.00266631, 0.00262837, 0.00337514, ..., 0.00482252, 0.00508082,\n",
|
||||
" 0.00521696], dtype=float32)"
|
||||
]
|
||||
},
|
||||
"execution_count": 45,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data[:, 0] "
|
||||
"data2 = data2.reshape(1, 7673, 5023, 3)\n",
|
||||
"\n",
|
||||
"np.save(path_data1_save, data2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
rec_perc = np.percentile(data[:, 0], q=75) * 2
|
||||
vel_perc = np.percentile(data[:, 1], q=75) * 5
|
||||
print(f"rec_prec 75% = {rec_perc}, vel_perc 75% = {vel_perc}")
|
||||
|
||||
processing... > 2021-P01
|
||||
(129700, 3)
|
||||
idx_rec len=1208/ total len=129700, percents = 0.9313801079414032 %
|
||||
idx_vel len=210/ total len=129700, percents = 0.16191210485736315 %
|
||||
idx_filter len=1407/ total len=129700, percents = 1.084811102544333 %
|
||||
idx_filter len=35159/ total len=129700, percents = 27.107941403238243 %
|
||||
remain idx len=94541/ total len=129700, percents = 72.89205859676176 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P01/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P02
|
||||
(148750, 3)
|
||||
idx_rec len=1990/ total len=148750, percents = 1.33781512605042 %
|
||||
idx_vel len=225/ total len=148750, percents = 0.15126050420168066 %
|
||||
idx_filter len=2201/ total len=148750, percents = 1.4796638655462184 %
|
||||
idx_filter len=38100/ total len=148750, percents = 25.613445378151262 %
|
||||
remain idx len=110650/ total len=148750, percents = 74.38655462184875 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P02/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P03
|
||||
(233050, 3)
|
||||
idx_rec len=3271/ total len=233050, percents = 1.4035614674962456 %
|
||||
idx_vel len=536/ total len=233050, percents = 0.22999356361295858 %
|
||||
idx_filter len=3772/ total len=233050, percents = 1.6185367946792535 %
|
||||
idx_filter len=78697/ total len=233050, percents = 33.76829006650933 %
|
||||
remain idx len=154353/ total len=233050, percents = 66.23170993349066 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P03/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P04
|
||||
(57350, 3)
|
||||
idx_rec len=307/ total len=57350, percents = 0.5353095030514385 %
|
||||
idx_vel len=112/ total len=57350, percents = 0.1952920662598082 %
|
||||
idx_filter len=418/ total len=57350, percents = 0.7288578901482128 %
|
||||
idx_filter len=15716/ total len=57350, percents = 27.403661726242373 %
|
||||
remain idx len=41634/ total len=57350, percents = 72.59633827375762 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P04/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P05
|
||||
(38850, 3)
|
||||
idx_rec len=309/ total len=38850, percents = 0.7953667953667953 %
|
||||
idx_vel len=81/ total len=38850, percents = 0.2084942084942085 %
|
||||
idx_filter len=388/ total len=38850, percents = 0.9987129987129987 %
|
||||
idx_filter len=12412/ total len=38850, percents = 31.948519948519948 %
|
||||
remain idx len=26438/ total len=38850, percents = 68.05148005148006 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P05/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P06
|
||||
(103900, 3)
|
||||
idx_rec len=777/ total len=103900, percents = 0.7478344562078922 %
|
||||
idx_vel len=303/ total len=103900, percents = 0.29162656400384984 %
|
||||
idx_filter len=1044/ total len=103900, percents = 1.0048123195380174 %
|
||||
idx_filter len=34870/ total len=103900, percents = 33.56111645813282 %
|
||||
remain idx len=69030/ total len=103900, percents = 66.43888354186718 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P06/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P07
|
||||
(27950, 3)
|
||||
idx_rec len=9/ total len=27950, percents = 0.03220035778175313 %
|
||||
idx_vel len=42/ total len=27950, percents = 0.15026833631484796 %
|
||||
idx_filter len=51/ total len=27950, percents = 0.18246869409660108 %
|
||||
idx_filter len=5839/ total len=27950, percents = 20.89087656529517 %
|
||||
remain idx len=22111/ total len=27950, percents = 79.10912343470483 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P07/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P08
|
||||
(184000, 3)
|
||||
idx_rec len=2284/ total len=184000, percents = 1.241304347826087 %
|
||||
idx_vel len=457/ total len=184000, percents = 0.2483695652173913 %
|
||||
idx_filter len=2720/ total len=184000, percents = 1.4782608695652173 %
|
||||
idx_filter len=62221/ total len=184000, percents = 33.81576086956522 %
|
||||
remain idx len=121779/ total len=184000, percents = 66.18423913043478 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P08/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P09
|
||||
(21500, 3)
|
||||
idx_rec len=306/ total len=21500, percents = 1.4232558139534883 %
|
||||
idx_vel len=222/ total len=21500, percents = 1.0325581395348837 %
|
||||
idx_filter len=487/ total len=21500, percents = 2.2651162790697676 %
|
||||
idx_filter len=13897/ total len=21500, percents = 64.63720930232559 %
|
||||
remain idx len=7603/ total len=21500, percents = 35.36279069767442 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P09/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P10
|
||||
(178750, 3)
|
||||
idx_rec len=1126/ total len=178750, percents = 0.62993006993007 %
|
||||
idx_vel len=375/ total len=178750, percents = 0.2097902097902098 %
|
||||
idx_filter len=1497/ total len=178750, percents = 0.8374825174825175 %
|
||||
idx_filter len=56091/ total len=178750, percents = 31.37958041958042 %
|
||||
remain idx len=122659/ total len=178750, percents = 68.62041958041958 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P10/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P11
|
||||
(73500, 3)
|
||||
idx_rec len=304/ total len=73500, percents = 0.41360544217687073 %
|
||||
idx_vel len=162/ total len=73500, percents = 0.22040816326530613 %
|
||||
idx_filter len=448/ total len=73500, percents = 0.6095238095238096 %
|
||||
idx_filter len=20965/ total len=73500, percents = 28.523809523809526 %
|
||||
remain idx len=52535/ total len=73500, percents = 71.47619047619048 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P11/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P12
|
||||
(51300, 3)
|
||||
idx_rec len=94/ total len=51300, percents = 0.18323586744639375 %
|
||||
idx_vel len=86/ total len=51300, percents = 0.16764132553606237 %
|
||||
idx_filter len=180/ total len=51300, percents = 0.3508771929824561 %
|
||||
idx_filter len=12907/ total len=51300, percents = 25.159844054580898 %
|
||||
remain idx len=38396/ total len=51300, percents = 74.84600389863547 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P12/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P14
|
||||
(18400, 3)
|
||||
idx_rec len=98/ total len=18400, percents = 0.532608695652174 %
|
||||
idx_vel len=123/ total len=18400, percents = 0.6684782608695652 %
|
||||
idx_filter len=202/ total len=18400, percents = 1.0978260869565217 %
|
||||
idx_filter len=7873/ total len=18400, percents = 42.78804347826087 %
|
||||
remain idx len=10530/ total len=18400, percents = 57.22826086956522 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P14/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P16
|
||||
(66400, 3)
|
||||
idx_rec len=173/ total len=66400, percents = 0.2605421686746988 %
|
||||
idx_vel len=111/ total len=66400, percents = 0.16716867469879518 %
|
||||
idx_filter len=279/ total len=66400, percents = 0.42018072289156627 %
|
||||
idx_filter len=16739/ total len=66400, percents = 25.20933734939759 %
|
||||
remain idx len=49661/ total len=66400, percents = 74.79066265060241 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P16/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P19
|
||||
(33350, 3)
|
||||
idx_rec len=140/ total len=33350, percents = 0.4197901049475262 %
|
||||
idx_vel len=48/ total len=33350, percents = 0.14392803598200898 %
|
||||
idx_filter len=186/ total len=33350, percents = 0.5577211394302849 %
|
||||
idx_filter len=7486/ total len=33350, percents = 22.44677661169415 %
|
||||
remain idx len=25864/ total len=33350, percents = 77.55322338830585 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P19/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P20
|
||||
(21300, 3)
|
||||
idx_rec len=68/ total len=21300, percents = 0.3192488262910798 %
|
||||
idx_vel len=13/ total len=21300, percents = 0.06103286384976526 %
|
||||
idx_filter len=81/ total len=21300, percents = 0.38028169014084506 %
|
||||
idx_filter len=2774/ total len=21300, percents = 13.023474178403756 %
|
||||
remain idx len=18529/ total len=21300, percents = 86.9906103286385 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P20/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P21
|
||||
(21300, 3)
|
||||
idx_rec len=4/ total len=21300, percents = 0.018779342723004695 %
|
||||
idx_vel len=17/ total len=21300, percents = 0.07981220657276995 %
|
||||
idx_filter len=21/ total len=21300, percents = 0.09859154929577464 %
|
||||
idx_filter len=2543/ total len=21300, percents = 11.938967136150234 %
|
||||
remain idx len=18757/ total len=21300, percents = 88.06103286384976 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P21/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P22
|
||||
(15700, 3)
|
||||
idx_rec len=76/ total len=15700, percents = 0.4840764331210191 %
|
||||
idx_vel len=45/ total len=15700, percents = 0.28662420382165604 %
|
||||
idx_filter len=118/ total len=15700, percents = 0.7515923566878981 %
|
||||
idx_filter len=6824/ total len=15700, percents = 43.46496815286624 %
|
||||
remain idx len=8876/ total len=15700, percents = 56.53503184713376 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P22/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P24
|
||||
(171900, 3)
|
||||
idx_rec len=983/ total len=171900, percents = 0.5718440954043048 %
|
||||
idx_vel len=399/ total len=171900, percents = 0.23211169284467714 %
|
||||
idx_filter len=1347/ total len=171900, percents = 0.7835951134380453 %
|
||||
idx_filter len=48662/ total len=171900, percents = 28.308318789994182 %
|
||||
remain idx len=123238/ total len=171900, percents = 71.69168121000581 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P24/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P25
|
||||
(74300, 3)
|
||||
idx_rec len=188/ total len=74300, percents = 0.253028263795424 %
|
||||
idx_vel len=158/ total len=74300, percents = 0.2126514131897712 %
|
||||
idx_filter len=323/ total len=74300, percents = 0.4347240915208614 %
|
||||
idx_filter len=12738/ total len=74300, percents = 17.14401076716016 %
|
||||
remain idx len=61562/ total len=74300, percents = 82.85598923283983 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P25/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P26
|
||||
(15250, 3)
|
||||
idx_rec len=11/ total len=15250, percents = 0.07213114754098361 %
|
||||
idx_vel len=17/ total len=15250, percents = 0.11147540983606558 %
|
||||
idx_filter len=26/ total len=15250, percents = 0.17049180327868851 %
|
||||
idx_filter len=1873/ total len=15250, percents = 12.281967213114754 %
|
||||
remain idx len=13377/ total len=15250, percents = 87.71803278688525 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P26/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P27
|
||||
(55700, 3)
|
||||
idx_rec len=194/ total len=55700, percents = 0.348294434470377 %
|
||||
idx_vel len=45/ total len=55700, percents = 0.0807899461400359 %
|
||||
idx_filter len=239/ total len=55700, percents = 0.42908438061041293 %
|
||||
idx_filter len=8551/ total len=55700, percents = 15.351885098743267 %
|
||||
remain idx len=47149/ total len=55700, percents = 84.64811490125673 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P27/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P29
|
||||
(35700, 3)
|
||||
idx_rec len=91/ total len=35700, percents = 0.2549019607843137 %
|
||||
idx_vel len=48/ total len=35700, percents = 0.13445378151260504 %
|
||||
idx_filter len=128/ total len=35700, percents = 0.3585434173669468 %
|
||||
idx_filter len=4113/ total len=35700, percents = 11.521008403361344 %
|
||||
remain idx len=31587/ total len=35700, percents = 88.47899159663865 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P29/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P30
|
||||
(163500, 3)
|
||||
idx_rec len=901/ total len=163500, percents = 0.5510703363914373 %
|
||||
idx_vel len=237/ total len=163500, percents = 0.14495412844036698 %
|
||||
idx_filter len=1115/ total len=163500, percents = 0.6819571865443425 %
|
||||
idx_filter len=34727/ total len=163500, percents = 21.239755351681957 %
|
||||
remain idx len=128773/ total len=163500, percents = 78.76024464831804 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P30/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P31
|
||||
(162650, 3)
|
||||
idx_rec len=433/ total len=162650, percents = 0.2662158007992622 %
|
||||
idx_vel len=147/ total len=162650, percents = 0.09037811251152782 %
|
||||
idx_filter len=580/ total len=162650, percents = 0.35659391331079004 %
|
||||
idx_filter len=24896/ total len=162650, percents = 15.306486320319705 %
|
||||
remain idx len=137754/ total len=162650, percents = 84.6935136796803 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P31/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P32
|
||||
(9000, 3)
|
||||
idx_rec len=40/ total len=9000, percents = 0.4444444444444444 %
|
||||
idx_vel len=7/ total len=9000, percents = 0.07777777777777778 %
|
||||
idx_filter len=47/ total len=9000, percents = 0.5222222222222223 %
|
||||
idx_filter len=1334/ total len=9000, percents = 14.822222222222223 %
|
||||
remain idx len=7666/ total len=9000, percents = 85.17777777777778 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P32/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P33
|
||||
(66850, 3)
|
||||
idx_rec len=984/ total len=66850, percents = 1.4719521316379955 %
|
||||
idx_vel len=195/ total len=66850, percents = 0.2916978309648467 %
|
||||
idx_filter len=1130/ total len=66850, percents = 1.6903515332834704 %
|
||||
idx_filter len=18149/ total len=66850, percents = 27.148840688107704 %
|
||||
remain idx len=48701/ total len=66850, percents = 72.8511593118923 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P33/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P34
|
||||
(11700, 3)
|
||||
idx_rec len=17/ total len=11700, percents = 0.1452991452991453 %
|
||||
idx_vel len=10/ total len=11700, percents = 0.08547008547008547 %
|
||||
idx_filter len=27/ total len=11700, percents = 0.23076923076923078 %
|
||||
idx_filter len=1916/ total len=11700, percents = 16.376068376068375 %
|
||||
remain idx len=9784/ total len=11700, percents = 83.62393162393163 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P34/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P35
|
||||
(31950, 3)
|
||||
idx_rec len=65/ total len=31950, percents = 0.20344287949921752 %
|
||||
idx_vel len=73/ total len=31950, percents = 0.22848200312989045 %
|
||||
idx_filter len=133/ total len=31950, percents = 0.4162754303599374 %
|
||||
idx_filter len=7522/ total len=31950, percents = 23.54303599374022 %
|
||||
remain idx len=24428/ total len=31950, percents = 76.45696400625978 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P35/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P36
|
||||
(15100, 3)
|
||||
idx_rec len=478/ total len=15100, percents = 3.165562913907285 %
|
||||
idx_vel len=26/ total len=15100, percents = 0.17218543046357615 %
|
||||
idx_filter len=502/ total len=15100, percents = 3.3245033112582782 %
|
||||
idx_filter len=4708/ total len=15100, percents = 31.178807947019866 %
|
||||
remain idx len=10392/ total len=15100, percents = 68.82119205298014 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P36/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P37
|
||||
(164200, 3)
|
||||
idx_rec len=705/ total len=164200, percents = 0.42935444579780757 %
|
||||
idx_vel len=138/ total len=164200, percents = 0.08404384896467722 %
|
||||
idx_filter len=840/ total len=164200, percents = 0.5115712545676004 %
|
||||
idx_filter len=23842/ total len=164200, percents = 14.520097442143728 %
|
||||
remain idx len=140358/ total len=164200, percents = 85.47990255785628 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P37/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P38
|
||||
(69050, 3)
|
||||
idx_rec len=250/ total len=69050, percents = 0.3620564808110065 %
|
||||
idx_vel len=58/ total len=69050, percents = 0.08399710354815351 %
|
||||
idx_filter len=308/ total len=69050, percents = 0.44605358435916004 %
|
||||
idx_filter len=8673/ total len=69050, percents = 12.560463432295439 %
|
||||
remain idx len=60377/ total len=69050, percents = 87.43953656770456 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P38/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P39
|
||||
(22400, 3)
|
||||
idx_rec len=164/ total len=22400, percents = 0.7321428571428571 %
|
||||
idx_vel len=33/ total len=22400, percents = 0.14732142857142858 %
|
||||
idx_filter len=189/ total len=22400, percents = 0.84375 %
|
||||
idx_filter len=4261/ total len=22400, percents = 19.022321428571427 %
|
||||
remain idx len=18139/ total len=22400, percents = 80.97767857142857 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P39/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P40
|
||||
(15700, 3)
|
||||
idx_rec len=0/ total len=15700, percents = 0.0 %
|
||||
idx_vel len=1/ total len=15700, percents = 0.006369426751592357 %
|
||||
idx_filter len=1/ total len=15700, percents = 0.006369426751592357 %
|
||||
idx_filter len=153/ total len=15700, percents = 0.9745222929936306 %
|
||||
remain idx len=15547/ total len=15700, percents = 99.02547770700637 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P40/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P41
|
||||
(50450, 3)
|
||||
idx_rec len=344/ total len=50450, percents = 0.6818632309217046 %
|
||||
idx_vel len=137/ total len=50450, percents = 0.27155599603567887 %
|
||||
idx_filter len=470/ total len=50450, percents = 0.931615460852329 %
|
||||
idx_filter len=15452/ total len=50450, percents = 30.62834489593657 %
|
||||
remain idx len=35001/ total len=50450, percents = 69.37760158572844 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P41/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P42
|
||||
(15100, 3)
|
||||
idx_rec len=12/ total len=15100, percents = 0.07947019867549669 %
|
||||
idx_vel len=27/ total len=15100, percents = 0.17880794701986755 %
|
||||
idx_filter len=36/ total len=15100, percents = 0.23841059602649006 %
|
||||
idx_filter len=3237/ total len=15100, percents = 21.43708609271523 %
|
||||
remain idx len=11863/ total len=15100, percents = 78.56291390728477 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P42/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P43
|
||||
(173900, 3)
|
||||
idx_rec len=745/ total len=173900, percents = 0.4284071305347901 %
|
||||
idx_vel len=291/ total len=173900, percents = 0.16733755031627373 %
|
||||
idx_filter len=1020/ total len=173900, percents = 0.58654399079931 %
|
||||
idx_filter len=39644/ total len=173900, percents = 22.79700977573318 %
|
||||
remain idx len=134259/ total len=173900, percents = 77.20471535365152 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P43/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P44
|
||||
(52750, 3)
|
||||
idx_rec len=308/ total len=52750, percents = 0.5838862559241706 %
|
||||
idx_vel len=70/ total len=52750, percents = 0.13270142180094788 %
|
||||
idx_filter len=373/ total len=52750, percents = 0.7071090047393365 %
|
||||
idx_filter len=8045/ total len=52750, percents = 15.251184834123222 %
|
||||
remain idx len=44705/ total len=52750, percents = 84.74881516587678 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P44/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P45
|
||||
(21450, 3)
|
||||
idx_rec len=23/ total len=21450, percents = 0.10722610722610723 %
|
||||
idx_vel len=6/ total len=21450, percents = 0.027972027972027972 %
|
||||
idx_filter len=29/ total len=21450, percents = 0.1351981351981352 %
|
||||
idx_filter len=1112/ total len=21450, percents = 5.1841491841491845 %
|
||||
remain idx len=20338/ total len=21450, percents = 94.81585081585082 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P45/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
|
||||
processing... > 2021-P46
|
||||
(36100, 3)
|
||||
idx_rec len=234/ total len=36100, percents = 0.6481994459833795 %
|
||||
idx_vel len=38/ total len=36100, percents = 0.10526315789473684 %
|
||||
idx_filter len=272/ total len=36100, percents = 0.7534626038781164 %
|
||||
idx_filter len=7231/ total len=36100, percents = 20.030470914127424 %
|
||||
remain idx len=28869/ total len=36100, percents = 79.96952908587258 %
|
||||
save to > /yrfs/lsen/DATA/LuoXData/processing2/2021-P46/audio/idx_w150_20220228-18H41M46S_175.npy
|
||||
@@ -0,0 +1,279 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Moviepy - Building video ../../coolTextEffects.avi.\n",
|
||||
"Moviepy - Writing video ../../coolTextEffects.avi\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Moviepy - Done !\n",
|
||||
"Moviepy - video ready ../../coolTextEffects.avi\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\r"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"from moviepy.editor import *\n",
|
||||
"from moviepy.video.tools.segmenting import findObjects\n",
|
||||
"\n",
|
||||
"# WE CREATE THE TEXT THAT IS GOING TO MOVE, WE CENTER IT.\n",
|
||||
"\n",
|
||||
"screensize = (720,460)\n",
|
||||
"txtClip = TextClip('Cool effect',color='white', font=\"Amiri-Bold\",\n",
|
||||
" kerning = 5, fontsize=100)\n",
|
||||
"cvc = CompositeVideoClip( [txtClip.set_pos('center')],\n",
|
||||
" size=screensize)\n",
|
||||
"\n",
|
||||
"# THE NEXT FOUR FUNCTIONS DEFINE FOUR WAYS OF MOVING THE LETTERS\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# helper function\n",
|
||||
"rotMatrix = lambda a: np.array( [[np.cos(a),np.sin(a)], \n",
|
||||
" [-np.sin(a),np.cos(a)]] )\n",
|
||||
"\n",
|
||||
"def vortex(screenpos,i,nletters):\n",
|
||||
" d = lambda t : 1.0/(0.3+t**8) #damping\n",
|
||||
" a = i*np.pi/ nletters # angle of the movement\n",
|
||||
" v = rotMatrix(a).dot([-1,0])\n",
|
||||
" if i%2 : v[1] = -v[1]\n",
|
||||
" return lambda t: screenpos+400*d(t)*rotMatrix(0.5*d(t)*a).dot(v)\n",
|
||||
" \n",
|
||||
"def cascade(screenpos,i,nletters):\n",
|
||||
" v = np.array([0,-1])\n",
|
||||
" d = lambda t : 1 if t<0 else abs(np.sinc(t)/(1+t**4))\n",
|
||||
" return lambda t: screenpos+v*400*d(t-0.15*i)\n",
|
||||
"\n",
|
||||
"def arrive(screenpos,i,nletters):\n",
|
||||
" v = np.array([-1,0])\n",
|
||||
" d = lambda t : max(0, 3-3*t)\n",
|
||||
" return lambda t: screenpos-400*v*d(t-0.2*i)\n",
|
||||
" \n",
|
||||
"def vortexout(screenpos,i,nletters):\n",
|
||||
" d = lambda t : max(0,t) #damping\n",
|
||||
" a = i*np.pi/ nletters # angle of the movement\n",
|
||||
" v = rotMatrix(a).dot([-1,0])\n",
|
||||
" if i%2 : v[1] = -v[1]\n",
|
||||
" return lambda t: screenpos+400*d(t-0.1*i)*rotMatrix(-0.2*d(t)*a).dot(v)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# WE USE THE PLUGIN findObjects TO LOCATE AND SEPARATE EACH LETTER\n",
|
||||
"\n",
|
||||
"letters = findObjects(cvc) # a list of ImageClips\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# WE ANIMATE THE LETTERS\n",
|
||||
"\n",
|
||||
"def moveLetters(letters, funcpos):\n",
|
||||
" return [ letter.set_pos(funcpos(letter.screenpos,i,len(letters)))\n",
|
||||
" for i,letter in enumerate(letters)]\n",
|
||||
"\n",
|
||||
"clips = [ CompositeVideoClip( moveLetters(letters,funcpos),\n",
|
||||
" size = screensize).subclip(0,5)\n",
|
||||
" for funcpos in [vortex, cascade, arrive, vortexout] ]\n",
|
||||
"\n",
|
||||
"# WE CONCATENATE EVERYTHING AND WRITE TO A FILE\n",
|
||||
"\n",
|
||||
"final_clip = concatenate_videoclips(clips)\n",
|
||||
"final_clip.write_videofile('../../coolTextEffects.avi',fps=25,codec='mpeg4')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"import resampy\n",
|
||||
"import random\n",
|
||||
"import numpy as np\n",
|
||||
"import numpy as np\n",
|
||||
"from scipy import interpolate\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def resample_by_nsteps(feat, nsteps_tgt):\n",
|
||||
" \"\"\" \n",
|
||||
" feat, (nframes, ... ) (with source_fps)\n",
|
||||
" \"\"\"\n",
|
||||
"\n",
|
||||
" nsteps_src = feat.shape[0]\n",
|
||||
" data_idx = np.arange(0, nsteps_src, 1)\n",
|
||||
" samp_idx = np.arange(0, nsteps_src-1, (nsteps_src - 1) / nsteps_tgt)\n",
|
||||
" # print(f\"data_idx = {list(data_idx)}\")\n",
|
||||
" # print(f\"smap_idx = {list(samp_idx)}\")\n",
|
||||
" # sample\n",
|
||||
" func = interpolate.interp1d(data_idx, y=feat, axis=0)\n",
|
||||
" data_interpolate = func(samp_idx)\n",
|
||||
"\n",
|
||||
" return data_interpolate\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# def convert_fps(feat, source_fps = 30, target_fps=25):\n",
|
||||
"# \"\"\" \n",
|
||||
"# feat, (nframes, ... ) (with source_fps)\n",
|
||||
"# \"\"\"\n",
|
||||
"\n",
|
||||
"# nsize = feat.shape[0]\n",
|
||||
"# data_idx = np.arange(0, nsize, 1)\n",
|
||||
"# samp_idx = np.arange(0, nsize-1, 1.0*source_fps/target_fps)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# print(f\"1.0*source_fps/target_fps = {1.0*source_fps/target_fps}\")\n",
|
||||
"\n",
|
||||
"# # get sample idx\n",
|
||||
"# # if source_fps > target_fps:\n",
|
||||
"\n",
|
||||
"# print(f\"data_idx = {list(data_idx)}\")\n",
|
||||
"# print(f\"smap_idx = {list(samp_idx)}\")\n",
|
||||
"\n",
|
||||
"# # sample\n",
|
||||
"# func = interpolate.interp1d(data_idx, y=feat, axis=0)\n",
|
||||
"# data_interpolate = func(samp_idx)\n",
|
||||
"\n",
|
||||
"# del func\n",
|
||||
"\n",
|
||||
"# return data_interpolate\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def interpolate_feat(feat, input_rate, output_rate, nsteps_tgt=None):\n",
|
||||
" \n",
|
||||
" feat_shape = feat.shape\n",
|
||||
" feat = feat.reshape(feat_shape[0], -1)\n",
|
||||
"\n",
|
||||
" dim_feat = feat.shape[1]\n",
|
||||
"\n",
|
||||
" nsteps_src = feat.shape[0]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" seq_len = nsteps_src / float(input_rate)\n",
|
||||
" if nsteps_tgt is None:\n",
|
||||
" nsteps_tgt = int(seq_len * output_rate)\n",
|
||||
"\n",
|
||||
" input_timestamps = np.arange(nsteps_src) / float(input_rate)\n",
|
||||
" output_timestamps = np.arange(nsteps_tgt) / float(output_rate)\n",
|
||||
" output_feat = np.zeros((nsteps_tgt, dim_feat))\n",
|
||||
"\n",
|
||||
" for feat in range(dim_feat):\n",
|
||||
" output_feat[:, feat] = np.interp(output_timestamps,\n",
|
||||
" input_timestamps,\n",
|
||||
" feat[:, feat])\n",
|
||||
" return output_feat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(150, 1024)"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"data.shape"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"nsteps = 150, random speed = 0.9, nsteps_speed = 135\n",
|
||||
"data_idx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134]\n",
|
||||
"smap_idx = [0.0, 0.8933333333333333, 1.7866666666666666, 2.6799999999999997, 3.5733333333333333, 4.466666666666667, 5.359999999999999, 6.253333333333333, 7.1466666666666665, 8.04, 8.933333333333334, 9.826666666666666, 10.719999999999999, 11.613333333333333, 12.506666666666666, 13.4, 14.293333333333333, 15.186666666666666, 16.08, 16.973333333333333, 17.866666666666667, 18.759999999999998, 19.653333333333332, 20.546666666666667, 21.439999999999998, 22.333333333333332, 23.226666666666667, 24.12, 25.013333333333332, 25.906666666666666, 26.8, 27.69333333333333, 28.586666666666666, 29.48, 30.37333333333333, 31.266666666666666, 32.16, 33.053333333333335, 33.946666666666665, 34.839999999999996, 35.733333333333334, 36.626666666666665, 37.519999999999996, 38.413333333333334, 39.306666666666665, 40.199999999999996, 41.093333333333334, 41.986666666666665, 42.879999999999995, 43.77333333333333, 44.666666666666664, 45.56, 46.45333333333333, 47.346666666666664, 48.24, 49.13333333333333, 50.026666666666664, 50.92, 51.81333333333333, 52.70666666666666, 53.6, 54.49333333333333, 55.38666666666666, 56.28, 57.17333333333333, 58.06666666666666, 58.96, 59.85333333333333, 60.74666666666666, 61.64, 62.53333333333333, 63.42666666666666, 64.32, 65.21333333333334, 66.10666666666667, 67.0, 67.89333333333333, 68.78666666666666, 69.67999999999999, 70.57333333333334, 71.46666666666667, 72.36, 73.25333333333333, 74.14666666666666, 75.03999999999999, 75.93333333333334, 76.82666666666667, 77.72, 78.61333333333333, 79.50666666666666, 80.39999999999999, 81.29333333333334, 82.18666666666667, 83.08, 83.97333333333333, 84.86666666666666, 85.75999999999999, 86.65333333333334, 87.54666666666667, 88.44, 89.33333333333333, 90.22666666666666, 91.12, 92.01333333333334, 92.90666666666667, 93.8, 94.69333333333333, 95.58666666666666, 96.48, 97.37333333333333, 98.26666666666667, 99.16, 100.05333333333333, 100.94666666666666, 101.84, 102.73333333333333, 103.62666666666667, 104.52, 105.41333333333333, 106.30666666666666, 107.2, 108.09333333333333, 108.98666666666666, 109.88, 110.77333333333333, 111.66666666666666, 112.56, 113.45333333333333, 114.34666666666666, 115.24, 116.13333333333333, 117.02666666666667, 117.92, 118.81333333333333, 119.70666666666666, 120.6, 121.49333333333333, 122.38666666666667, 123.28, 124.17333333333333, 125.06666666666666, 125.96, 126.85333333333332, 127.74666666666667, 128.64, 129.53333333333333, 130.42666666666668, 131.32, 132.21333333333334, 133.10666666666665]\n",
|
||||
"data shape = (135, 1024), data_convert = (150, 1024), nstep_speed=135\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data = np.random.random(size=(150, 1024))\n",
|
||||
"nsteps = data.shape[0]\n",
|
||||
"\n",
|
||||
"speed = random.sample({0.5, 0.7, 0.8, 0.9, 1.1, 1.2, 1.3, 1.4, 1.5},1)[0]\n",
|
||||
"nsteps_speed = int(nsteps * speed)\n",
|
||||
"\n",
|
||||
"data = np.random.random(size=(nsteps_speed, 1024))\n",
|
||||
"\n",
|
||||
"print(f\"nsteps = {nsteps}, random speed = {speed}, nsteps_speed = {nsteps_speed}\")\n",
|
||||
"\n",
|
||||
"data_convert = resample_by_nsteps(data, nsteps_tgt=nsteps)\n",
|
||||
"\n",
|
||||
"print(f\"data shape = {data.shape}, data_convert = {data_convert.shape}, nstep_speed={nsteps_speed}\")\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"interpreter": {
|
||||
"hash": "7631c3454b293d59f44fb25da873c3d73daf8a0a859dfd3174f920d540a4d0d0"
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.8 ('base')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.8"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in new issue
Block a user