0
$\begingroup$

This is my code;

for img_loc in list(self.train_data)[idx]:
   images_set.append(self.load_ucf_image(img_loc))
print(images_set)

And, this is its output

[tensor([[[ 1.7865,  1.8893,  1.9578,  ..., -1.3815, -0.4054,  0.2967],
             [ 1.7694,  1.8722,  1.9578,  ..., -0.6452, -0.4054,  0.1254],
             [ 1.7523,  1.8722,  1.9749,  ..., -0.5082, -0.6623, -0.3541],
             ...,
             [-1.9809, -1.6384, -1.2617,  ..., -1.7754, -1.0562, -0.9020],
             [-2.0494, -1.8268, -1.5014,  ..., -1.1075, -1.4672, -1.7069],
             [-1.9980, -1.8953, -1.4672,  ..., -1.7412, -1.7069, -1.2445]],
    
            [[ 1.0805,  1.2556,  1.3606,  ..., -1.1954, -0.1975,  0.4678],
             [ 1.1155,  1.2731,  1.3957,  ..., -0.4426, -0.1975,  0.3102],
             [ 1.1155,  1.2731,  1.3957,  ..., -0.2850, -0.4426, -0.1800],
             ...,
             [-1.9657, -1.7556, -1.4580,  ..., -1.8957, -1.2304, -1.1253],
             [-2.0007, -1.9132, -1.6856,  ..., -1.1954, -1.6331, -1.9482],
             [-1.9482, -1.9482, -1.5980,  ..., -1.8431, -1.8782, -1.4230]],
    
            [[ 1.4548,  1.6640,  1.8034,  ..., -0.4624,  0.5311,  1.3502],
             [ 1.5071,  1.7163,  1.8557,  ...,  0.2871,  0.5311,  1.1411],
             [ 1.5245,  1.7511,  1.9080,  ...,  0.3916,  0.2348,  0.6182],
             ...,
             [-1.4907, -1.3164, -1.0550,  ..., -1.5953, -0.9504, -0.8284],
             [-1.5430, -1.4907, -1.2816,  ..., -0.8633, -1.3164, -1.6476],
             [-1.4907, -1.5256, -1.2119,  ..., -1.5081, -1.5256, -1.1421]]]), tensor([[[-0.4054, -0.3883, -0.4739,  ...,  2.1119,  2.0948,  2.0777],
             [-0.3712, -0.2856, -0.4397,  ...,  2.0948,  2.0777,  2.0434],
             [-0.3541, -0.2513,  0.1083,  ...,  2.0777,  2.0434,  2.0263],
             ...,
             [-1.0219, -1.2617, -1.2103,  ..., -0.0629, -0.1999, -0.2171],
             [-1.0048, -1.3302, -1.3302,  ..., -0.0801, -0.1828, -0.4226],
             [-1.3302, -0.9705, -1.0562,  ..., -0.0458, -0.1486, -0.7993]],
    
            [[-0.2325, -0.2150, -0.2675,  ...,  1.5707,  1.5007,  1.4132],
             [-0.1975, -0.1099, -0.2500,  ...,  1.6057,  1.5357,  1.4482],
             [-0.2150, -0.1099,  0.2752,  ...,  1.6057,  1.5532,  1.4482],
             ...,
             [-1.1779, -1.4230, -1.3704,  ..., -0.3901, -0.4776, -0.4776],
             [-1.1779, -1.5630, -1.5280,  ..., -0.4076, -0.4601, -0.6527],
             [-1.5630, -1.2304, -1.2829,  ..., -0.3200, -0.3901, -1.0028]],
    
            [[ 0.7751,  0.7925,  0.6531,  ...,  2.0300,  1.9428,  1.8731],
             [ 0.8099,  0.8971,  0.6356,  ...,  2.0823,  1.9951,  1.9254],
             [ 0.8099,  0.8797,  1.1759,  ...,  2.1171,  2.0300,  1.9603],
             ...,
             [-0.8981, -1.1073, -1.0201,  ..., -0.0092, -0.0790, -0.0441],
             [-0.8981, -1.2293, -1.1944,  ..., -0.0267, -0.0615, -0.2184],
             [-1.2990, -0.9156, -0.9853,  ...,  0.0431, -0.0092, -0.5670]]]), tensor([[[ 1.9749,  1.8208,  1.9749,  ..., -0.8678, -0.8335, -0.8678],
             [ 2.0777,  1.8893,  2.0777,  ..., -0.8507, -0.8164, -0.8507],
             [ 2.1290,  2.0777,  2.1290,  ..., -0.7993, -0.7822, -0.7993],
             ...,
             [-1.2617, -1.3644, -1.4672,  ..., -1.9980, -2.0665, -2.1008],
             [-1.1760, -1.2617, -1.3815,  ..., -2.0665, -2.0837, -2.0837],
             [-1.0904, -1.1760, -1.3302,  ..., -2.1008, -2.0323, -2.0837]],
    
            [[ 1.3256,  1.1856,  1.3431,  ..., -0.7402, -0.7227, -0.7577],
             [ 1.4482,  1.3081,  1.5007,  ..., -0.7227, -0.7227, -0.7402],
             [ 1.5532,  1.5357,  1.6057,  ..., -0.6702, -0.6877, -0.6877],
             ...,
             [-1.4230, -1.5630, -1.7031,  ..., -2.0007, -2.0357, -2.0357],
             [-1.3354, -1.4405, -1.6155,  ..., -2.0357, -2.0357, -2.0357],
             [-1.2479, -1.3529, -1.5630,  ..., -2.0357, -1.9832, -2.0182]],
    
            [[ 1.7163,  1.5768,  1.7511,  ...,  0.0082, -0.0092, -0.0441],
             [ 1.8383,  1.6814,  1.8905,  ...,  0.0431,  0.0431, -0.0267],
             [ 1.9254,  1.8905,  1.9777,  ...,  0.0953,  0.0779, -0.0092],
             ...,
             [-1.1073, -1.2293, -1.4036,  ..., -1.6650, -1.6824, -1.6824],
             [-1.0550, -1.1596, -1.3164,  ..., -1.7696, -1.7173, -1.6999],
             [-0.9678, -1.0724, -1.2641,  ..., -1.7696, -1.6650, -1.6999]]]), tensor([[[-0.6794, -0.6452, -0.6452,  ...,  2.1804,  2.1290,  2.0777],
             [-0.6794, -0.6452, -0.5596,  ...,  2.1633,  2.1804,  2.0948],
             [-0.6452, -0.5767, -0.4739,  ...,  2.1462,  2.0948,  2.0434],
             ...,
             [-1.9980, -2.0494, -2.0494,  ..., -1.4158, -1.3130, -1.3130],
             [-2.0152, -2.0665, -1.9980,  ..., -1.3644, -1.2445, -1.1760],
             [-2.0152, -2.0494, -2.0323,  ..., -1.3473, -1.2445, -1.0904]],
    
            [[-0.6176, -0.5826, -0.5651,  ...,  1.6933,  1.6057,  1.5182],
             [-0.6176, -0.5476, -0.4776,  ...,  1.7633,  1.7108,  1.5707],
             [-0.5826, -0.4776, -0.3901,  ...,  1.7983,  1.6933,  1.6057],
             ...,
             [-2.0007, -2.0357, -2.0357,  ..., -1.7556, -1.5805, -1.4930],
             [-2.0182, -2.0357, -2.0182,  ..., -1.7031, -1.5455, -1.4055],
             [-1.9657, -2.0357, -2.0182,  ..., -1.6856, -1.5455, -1.3179]],
    
            [[ 0.0779,  0.1825,  0.3045,  ...,  2.0997,  1.9777,  1.9080],
             [ 0.1128,  0.2348,  0.4265,  ...,  2.1346,  2.0648,  1.9428],
             [ 0.1476,  0.3045,  0.5136,  ...,  2.1520,  2.0648,  1.9428],
             ...,
             [-1.6650, -1.7522, -1.7696,  ..., -1.4559, -1.2641, -1.2119],
             [-1.7173, -1.8044, -1.7522,  ..., -1.4036, -1.2119, -1.1073],
             [-1.7173, -1.7870, -1.7696,  ..., -1.3861, -1.2119, -1.0201]]]), tensor([[[-0.3712, -0.4054, -0.3369,  ...,  2.0092,  1.9407,  1.8379],
             [-0.3027, -0.2684, -0.3712,  ...,  2.0263,  1.9749,  1.8550],
             [-0.1486, -0.3198, -0.3712,  ...,  2.0092,  1.9578,  1.9064],
             ...,
             [-1.9638, -2.0494, -2.0494,  ..., -1.9638, -2.0665, -2.0152],
             [-1.9467, -2.0323, -1.9467,  ..., -1.9467, -2.0837, -2.0152],
             [-1.1418, -1.9638, -2.0323,  ..., -2.0323, -2.0323, -1.9980]],
    
            [[-0.1975, -0.2325, -0.1975,  ...,  1.2906,  1.1856,  1.0280],
             [-0.1275, -0.0924, -0.2325,  ...,  1.3256,  1.2556,  1.1331],
             [-0.0049, -0.1800, -0.2325,  ...,  1.3782,  1.3081,  1.2031],
             ...,
             [-2.0357, -2.0357, -2.0357,  ..., -1.8957, -1.9482, -1.8782],
             [-2.0357, -2.0357, -1.9832,  ..., -1.8782, -1.9482, -1.8256],
             [-1.2129, -2.0007, -2.0357,  ..., -1.9132, -1.8431, -1.7906]],
    
            [[ 0.7751,  0.7402,  0.7925,  ...,  1.6291,  1.5420,  1.4025],
             [ 0.8448,  0.9145,  0.7576,  ...,  1.6988,  1.6291,  1.4722],
             [ 0.9842,  0.8448,  0.7576,  ...,  1.7685,  1.6988,  1.5768],
             ...,
             [-1.7173, -1.7696, -1.7696,  ..., -1.4210, -1.4559, -1.3861],
             [-1.6476, -1.6999, -1.6127,  ..., -1.4036, -1.4559, -1.3164],
             [-0.8284, -1.6302, -1.6476,  ..., -1.4210, -1.3339, -1.2816]]]), tensor([[[-0.3198, -0.3883, -0.4226,  ...,  1.8893,  1.7352,  1.7352],
             [-0.2684, -0.3369, -0.3541,  ...,  1.8893,  1.7523,  1.7523],
             [-0.1999, -0.2342, -0.3712,  ...,  1.9235,  1.8037,  1.8037],
             ...,
             [-2.0323, -2.0494, -2.1008,  ..., -1.8268, -1.8268, -1.7754],
             [-1.9809, -2.0323, -1.9980,  ..., -1.8097, -1.7583, -1.6727],
             [-1.9638, -2.0494, -2.0665,  ..., -1.7925, -1.7583, -1.6898]],
    
            [[-0.1625, -0.2325, -0.2675,  ...,  1.0980,  0.8704,  0.8704],
             [-0.1099, -0.1975, -0.2150,  ...,  1.1506,  0.9405,  0.9405],
             [-0.0574, -0.0924, -0.2325,  ...,  1.2206,  1.0630,  1.0105],
             ...,
             [-2.0357, -2.0007, -2.0357,  ..., -1.7906, -1.7206, -1.6331],
             [-2.0007, -2.0182, -1.9832,  ..., -1.7381, -1.6155, -1.4930],
             [-2.0357, -2.0357, -2.0357,  ..., -1.6681, -1.5805, -1.5105]],
    
            [[ 0.7751,  0.7054,  0.6705,  ...,  1.3677,  1.1237,  1.1237],
             [ 0.8274,  0.7925,  0.7751,  ...,  1.4025,  1.2108,  1.1759],
             [ 0.9319,  0.8971,  0.7576,  ...,  1.4897,  1.3154,  1.2805],
             ...,
             [-1.6999, -1.7173, -1.7696,  ..., -1.2641, -1.1770, -1.1073],
             [-1.6999, -1.7696, -1.7347,  ..., -1.2293, -1.0898, -0.9330],
             [-1.7173, -1.7696, -1.7696,  ..., -1.1770, -1.0201, -0.9504]]]), tensor([[[ 2.0605,  2.0434,  2.0263,  ..., -0.3198, -0.3027, -0.2856],
             [ 2.0434,  2.0263,  2.0263,  ..., -0.2171, -0.2171, -0.2171],
             [ 2.0777,  2.0263,  2.0092,  ..., -0.1999, -0.1828, -0.1999],
             ...,
             [ 0.3652,  0.4337,  0.3823,  ..., -2.0323, -2.0152, -1.9809],
             [ 0.3823,  0.4679,  0.4337,  ..., -2.0152, -2.0323, -2.0494],
             [ 0.3823,  0.3652,  0.4337,  ..., -1.9638, -2.0323, -2.0665]],
    
            [[ 1.6232,  1.6758,  1.7283,  ..., -0.1450, -0.1800, -0.1625],
             [ 1.6758,  1.7283,  1.8333,  ..., -0.0574, -0.0924, -0.0924],
             [ 1.7283,  1.7983,  1.8859,  ..., -0.0399, -0.0574, -0.0749],
             ...,
             [ 0.1352,  0.2052,  0.1352,  ..., -2.0357, -2.0357, -2.0007],
             [ 0.1877,  0.2402,  0.1702,  ..., -2.0357, -2.0357, -2.0357],
             [ 0.2227,  0.1352,  0.1702,  ..., -1.9657, -2.0357, -2.0357]],
    
            [[ 1.9603,  2.0300,  2.0648,  ...,  0.6879,  0.6356,  0.6531],
             [ 2.0300,  2.0997,  2.1694,  ...,  0.8448,  0.7576,  0.7576],
             [ 2.1171,  2.1520,  2.2043,  ...,  0.8971,  0.8274,  0.7751],
             ...,
             [ 0.4788,  0.5136,  0.4091,  ..., -1.7870, -1.8044, -1.7347],
             [ 0.5136,  0.5834,  0.4962,  ..., -1.8044, -1.8044, -1.8044],
             [ 0.5485,  0.4788,  0.4962,  ..., -1.7870, -1.8044, -1.8044]]]), tensor([[[-0.3369, -0.3198, -0.3541,  ...,  2.0605,  2.0777,  2.0948],
             [-0.2684, -0.2342, -0.2513,  ...,  2.0605,  2.0948,  2.0777],
             [-0.2342, -0.1657, -0.1828,  ...,  2.0434,  2.0777,  2.0777],
             ...,
             [-2.0494, -1.9980, -1.9124,  ...,  0.5193,  0.5536,  0.4851],
             [-1.9638, -1.9980, -1.9980,  ...,  0.5193,  0.5364,  0.4508],
             [-2.0494, -2.0494, -1.9638,  ...,  0.5193,  0.5022,  0.4166]],
    
            [[-0.1975, -0.1800, -0.1800,  ...,  1.6933,  1.6758,  1.6232],
             [-0.1450, -0.1099, -0.0924,  ...,  1.7633,  1.7458,  1.6758],
             [-0.1099, -0.0399, -0.0224,  ...,  1.8158,  1.8158,  1.7458],
             ...,
             [-2.0357, -2.0357, -1.9832,  ...,  0.2227,  0.2402,  0.2227],
             [-1.9832, -2.0182, -2.0182,  ...,  0.2577,  0.2752,  0.2227],
             [-2.0357, -2.0357, -1.9832,  ...,  0.2577,  0.2752,  0.2052]],
    
            [[ 0.5659,  0.5834,  0.6531,  ...,  2.0125,  2.0125,  1.9603],
             [ 0.6705,  0.7054,  0.7925,  ...,  2.0997,  2.0997,  2.0125],
             [ 0.7402,  0.8099,  0.8797,  ...,  2.1346,  2.1346,  2.0474],
             ...,
             [-1.7696, -1.7870, -1.7347,  ...,  0.5485,  0.6182,  0.6182],
             [-1.7173, -1.7522, -1.7522,  ...,  0.5834,  0.6356,  0.6008],
             [-1.8044, -1.8044, -1.7173,  ...,  0.5834,  0.6182,  0.5834]]]), tensor([[[ 2.0777,  2.0605,  2.0777,  ...,  0.1426,  0.1083,  0.0569],
             [ 2.1119,  2.0777,  2.0948,  ...,  0.1939,  0.1597,  0.0569],
             [ 2.0948,  2.0777,  2.0948,  ...,  0.1768,  0.1426,  0.0056],
             ...,
             [ 0.4679,  0.6906,  0.7248,  ..., -0.5253, -0.5082, -0.5938],
             [ 0.0912,  0.6049,  0.7248,  ..., -0.6281, -0.9877, -0.5082],
             [-0.5253,  0.5707,  0.6734,  ..., -0.8678, -0.6452, -0.2342]],
    
            [[ 1.9559,  2.0084,  2.0784,  ...,  0.2227,  0.1877,  0.1352],
             [ 2.0259,  2.0609,  2.0959,  ...,  0.2227,  0.1877,  0.0826],
             [ 2.0084,  2.0609,  2.0959,  ...,  0.2227,  0.1702,  0.0301],
             ...,
             [ 0.2052,  0.3627,  0.3452,  ..., -0.7927, -0.8277, -0.9153],
             [-0.1450,  0.2752,  0.3452,  ..., -0.9678, -1.3880, -0.9153],
             [-0.7752,  0.2402,  0.3102,  ..., -1.2829, -1.0903, -0.7052]],
    
            [[ 2.3088,  2.3437,  2.4308,  ...,  1.1934,  1.1585,  1.1062],
             [ 2.3611,  2.3786,  2.4483,  ...,  1.2108,  1.1759,  1.0714],
             [ 2.3437,  2.3786,  2.4483,  ...,  1.1585,  1.1585,  1.0191],
             ...,
             [ 0.6008,  0.7402,  0.7054,  ..., -0.5147, -0.5495, -0.6367],
             [ 0.2348,  0.6182,  0.7054,  ..., -0.6890, -1.1247, -0.6541],
             [-0.3927,  0.5834,  0.6182,  ..., -1.0201, -0.8458, -0.4624]]]), tensor([[[ 2.1119,  2.1633,  2.0948,  ..., -0.1143, -0.1486, -0.1657],
             [ 2.0777,  2.0605,  2.1119,  ..., -0.0458, -0.0629, -0.0972],
             [ 2.1462,  2.1633,  2.0777,  ...,  0.0569,  0.0569,  0.0056],
             ...,
             [ 0.3652,  0.4679,  0.6563,  ..., -2.0323, -1.9638, -1.9980],
             [ 0.1083,  0.4679,  0.6734,  ..., -1.8610, -1.8953, -1.9638],
             [-0.4911,  0.4337,  0.6392,  ..., -0.6109, -1.8097, -1.8953]],
    
            [[ 1.5007,  1.6408,  1.6933,  ..., -0.1275, -0.1450, -0.1625],
             [ 1.5357,  1.6232,  1.7633,  ..., -0.0399, -0.0224, -0.0574],
             [ 1.6758,  1.7983,  1.8508,  ...,  0.0651,  0.0826,  0.0301],
             ...,
             [ 0.0826,  0.1176,  0.2577,  ..., -2.0357, -1.9832, -1.9832],
             [-0.1450,  0.1527,  0.2927,  ..., -1.9307, -1.9132, -1.9832],
             [-0.7227,  0.1702,  0.3102,  ..., -0.7402, -1.9307, -2.0182]],
    
            [[ 1.8383,  2.0125,  2.0648,  ...,  0.8099,  0.7925,  0.7751],
             [ 1.8905,  1.9603,  2.1171,  ...,  0.9145,  0.9145,  0.8797],
             [ 2.0125,  2.1520,  2.2043,  ...,  1.0191,  1.0714,  1.0191],
             ...,
             [ 0.5311,  0.5485,  0.6182,  ..., -1.8044, -1.7522, -1.7696],
             [ 0.2871,  0.5311,  0.6531,  ..., -1.6824, -1.6824, -1.7522],
             [-0.3055,  0.5311,  0.6531,  ..., -0.5147, -1.6999, -1.7870]]]), tensor([[[ 1.3755,  1.6153,  1.7694,  ...,  0.0912,  0.2282,  0.1083],
             [ 1.4269,  1.6495,  1.7694,  ...,  0.1768, -0.0801, -0.7650],
             [ 1.3755,  1.6324,  1.8037,  ...,  0.0741, -0.5253, -0.0116],
             ...,
             [-1.5528, -1.5699, -1.8097,  ..., -0.8849, -0.6794, -0.6965],
             [-1.6042, -1.5870, -1.8097,  ..., -0.7479, -0.9534, -1.3302],
             [-1.6898, -1.6727, -1.7412,  ..., -1.6384, -1.3130, -0.7822]],
    
            [[ 0.6429,  0.9230,  1.0980,  ...,  0.2052,  0.3277,  0.2052],
             [ 0.6954,  0.9405,  1.1331,  ...,  0.2927,  0.0126, -0.6877],
             [ 0.6604,  0.9580,  1.1681,  ...,  0.1702, -0.4951,  0.0476],
             ...,
             [-1.4230, -1.3880, -1.6155,  ..., -0.7927, -0.6527, -0.7752],
             [-1.4230, -1.3704, -1.5805,  ..., -0.6352, -0.9678, -1.4230],
             [-1.5105, -1.4405, -1.5105,  ..., -1.6681, -1.4230, -0.9503]],
    
            [[ 0.7925,  1.0539,  1.2805,  ...,  1.1585,  1.2457,  1.1062],
             [ 0.8971,  1.1411,  1.3502,  ...,  1.2457,  0.9319,  0.2173],
             [ 0.8971,  1.1759,  1.4200,  ...,  1.0888,  0.4265,  0.9145],
             ...,
             [-0.8284, -0.8284, -1.1421,  ..., -0.4798, -0.3230, -0.4101],
             [-0.8633, -0.8633, -1.1247,  ..., -0.3753, -0.6193, -1.0898],
             [-0.9504, -0.9853, -1.0898,  ..., -1.3164, -1.0201, -0.5495]]]), tensor([[[ 0.0056,  0.0912,  0.1254,  ...,  2.1633,  2.1119,  2.1119],
             [ 0.0569,  0.1597,  0.1254,  ...,  2.1633,  2.1119,  2.1462],
             [ 0.0227,  0.1426,  0.1597,  ...,  2.1804,  2.1462,  2.0948],
             ...,
             [-0.5082, -0.9705, -0.6109,  ...,  0.6049, -0.1999, -1.0219],
             [-0.2171, -0.6452, -0.7650,  ...,  0.6049, -0.6281, -0.9877],
             [-1.1075,  0.0227, -0.6281,  ...,  0.4337, -0.8507, -1.1247]],
    
            [[ 0.1001,  0.2052,  0.2402,  ...,  1.8859,  1.7458,  1.5882],
             [ 0.1527,  0.2402,  0.2402,  ...,  1.8859,  1.7458,  1.6232],
             [ 0.1176,  0.2227,  0.2577,  ...,  1.9034,  1.7633,  1.6232],
             ...,
             [-0.8978, -1.3704, -0.9503,  ...,  0.3627, -0.3725, -1.0903],
             [-0.6176, -1.0553, -1.1604,  ...,  0.3627, -0.7752, -1.0028],
             [-1.5630, -0.3725, -1.0203,  ...,  0.2227, -1.0028, -1.1429]],
    
            [[ 1.0191,  1.1585,  1.1934,  ...,  2.2566,  2.0648,  1.9428],
             [ 1.0714,  1.2108,  1.1585,  ...,  2.2914,  2.0997,  1.9777],
             [ 1.0365,  1.1934,  1.1759,  ...,  2.3088,  2.1694,  1.9777],
             ...,
             [-0.6367, -1.1073, -0.6715,  ...,  0.6356, -0.0441, -0.7238],
             [-0.3927, -0.8284, -0.8981,  ...,  0.6356, -0.4973, -0.6541],
             [-1.3164, -0.1487, -0.7587,  ...,  0.4614, -0.7238, -0.7936]]]), tensor([[[ 2.0777,  2.1119,  2.1119,  ...,  0.0569, -0.0629, -0.2171],
             [ 2.0777,  2.1290,  2.1119,  ...,  0.0056, -0.1143, -0.2513],
             [ 2.0777,  2.0948,  2.1290,  ...,  0.0056, -0.1143, -0.1999],
             ...,
             [ 0.4851,  0.5707,  0.5707,  ..., -0.2171, -0.8849, -0.9192],
             [ 0.3481,  0.5707,  0.5536,  ..., -1.1075, -0.7650, -0.3883],
             [-0.1657,  0.5193,  0.5193,  ..., -0.8678, -0.3712, -1.1760]],
    
            [[ 1.6408,  1.8158,  1.9384,  ...,  0.1527, -0.0224, -0.1625],
             [ 1.6758,  1.8508,  1.9909,  ...,  0.1001, -0.0574, -0.1975],
             [ 1.6758,  1.8683,  2.0084,  ...,  0.0476, -0.0574, -0.1800],
             ...,
             [ 0.2577,  0.2752,  0.2577,  ..., -0.6176, -1.3004, -1.3354],
             [ 0.1352,  0.2752,  0.2402,  ..., -1.5455, -1.1779, -0.7927],
             [-0.3725,  0.2227,  0.2052,  ..., -1.2829, -0.7752, -1.5280]],
    
            [[ 1.9603,  2.1520,  2.3088,  ...,  1.0714,  0.8971,  0.6705],
             [ 2.0125,  2.2217,  2.3437,  ...,  1.0191,  0.8099,  0.6008],
             [ 2.0125,  2.2217,  2.3960,  ...,  0.9668,  0.8099,  0.6356],
             ...,
             [ 0.5659,  0.5659,  0.5311,  ..., -0.3927, -1.0724, -1.0724],
             [ 0.3916,  0.5485,  0.5136,  ..., -1.3513, -0.9504, -0.5321],
             [-0.1138,  0.4962,  0.4788,  ..., -1.0550, -0.5147, -1.2467]]]), tensor([[[ 0.0398, -0.8678, -0.1486,  ...,  1.6153,  1.0502,  0.7077],
             [ 0.0741, -0.1486, -0.7822,  ...,  1.6495,  1.1358,  0.7933],
             [-0.2513, -0.0972, -0.6965,  ...,  1.6495,  1.1872,  0.7933],
             ...,
             [-0.6452, -1.3815, -0.9192,  ..., -1.9124, -1.6727, -1.7583],
             [-1.1932, -0.7822, -1.3644,  ..., -1.8782, -1.6727, -1.8097],
             [-1.5699, -1.4158, -0.6452,  ..., -1.7925, -1.7069, -1.8268]],
    
            [[ 0.0826, -0.7927, -0.0574,  ...,  0.8179,  0.2752, -0.0399],
             [ 0.1176, -0.1099, -0.7052,  ...,  0.8529,  0.3277,  0.0476],
             [-0.2325, -0.0399, -0.6176,  ...,  0.8529,  0.3803,  0.0476],
             ...,
             [-0.8627, -1.5105, -0.9678,  ..., -1.7206, -1.5280, -1.6155],
             [-1.4405, -0.9503, -1.4755,  ..., -1.6506, -1.4755, -1.6155],
             [-1.8256, -1.5980, -0.7402,  ..., -1.5280, -1.5105, -1.6331]],
    
            [[ 1.0191,  0.1128,  0.8622,  ...,  0.9842,  0.3916,  0.1302],
             [ 1.0365,  0.8099,  0.2173,  ...,  1.0191,  0.4614,  0.1999],
             [ 0.6531,  0.8274,  0.2871,  ...,  1.0191,  0.5136,  0.1999],
             ...,
             [-0.5321, -1.1596, -0.6541,  ..., -1.2467, -1.0376, -1.1247],
             [-1.0550, -0.5495, -1.0724,  ..., -1.1944, -0.9678, -1.1421],
             [-1.4384, -1.1944, -0.3055,  ..., -1.0898, -1.0027, -1.1247]]]), tensor([[[-0.3369, -0.2684, -0.1486,  ...,  2.0434,  2.1290,  2.0605],
             [-0.3883, -0.3027, -0.1657,  ...,  2.0605,  2.1462,  2.0605],
             [-0.3883, -0.2684, -0.1486,  ...,  2.0605,  2.1462,  2.0263],
             ...,
             [-1.1075, -1.0219, -0.2684,  ...,  0.4166,  0.3652,  0.2111],
             [-0.5596, -0.9020, -1.1760,  ...,  0.3481,  0.3823,  0.0227],
             [-1.3815, -0.5938, -1.0562,  ...,  0.3138,  0.3652, -0.3712]],
    
            [[-0.3550, -0.2850, -0.1625,  ...,  1.7458,  1.7458,  1.6057],
             [-0.4076, -0.3200, -0.1800,  ...,  1.7983,  1.7808,  1.6232],
             [-0.4076, -0.2850, -0.1625,  ...,  1.8333,  1.7983,  1.6232],
             ...,
             [-1.5805, -1.5280, -0.7577,  ...,  0.0476,  0.0651, -0.0049],
             [-1.0203, -1.4055, -1.6856,  ...,  0.0126,  0.1352, -0.1450],
             [-1.7556, -0.9853, -1.4755,  ..., -0.0224,  0.1176, -0.5476]],
    
            [[ 0.5136,  0.6182,  0.7751,  ...,  2.0474,  2.0474,  1.8905],
             [ 0.4614,  0.5834,  0.7576,  ...,  2.1171,  2.0997,  1.9428],
             [ 0.4614,  0.6182,  0.7751,  ...,  2.1868,  2.1520,  1.9603],
             ...,
             [-1.2293, -1.1944, -0.4624,  ...,  0.3568,  0.3916,  0.3742],
             [-0.6715, -1.0724, -1.3861,  ...,  0.3219,  0.4091,  0.1825],
             [-1.4384, -0.6890, -1.2119,  ...,  0.2871,  0.3916, -0.2184]]]), tensor([[[-1.4329, -0.4397,  0.8276,  ..., -0.6281, -0.6281, -0.6623],
             [-0.8335,  0.5022,  1.4783,  ..., -0.5938, -0.5767, -0.5938],
             [ 0.0569,  1.1700,  1.5468,  ..., -0.5767, -0.5424, -0.5253],
             ...,
             [-2.1008, -2.1008, -2.0665,  ..., -1.9809, -1.9295, -1.9467],
             [-2.1008, -2.1179, -2.0665,  ..., -1.9980, -1.9980, -2.0494],
             [-2.0837, -2.1179, -2.0665,  ..., -2.0665, -2.0665, -1.9638]],
    
            [[-1.8431, -1.0028,  0.1702,  ..., -0.6176, -0.5826, -0.6176],
             [-1.3179, -0.0924,  0.7654,  ..., -0.5826, -0.5301, -0.5476],
             [-0.4951,  0.5203,  0.8179,  ..., -0.5301, -0.4601, -0.4426],
             ...,
             [-2.0182, -2.0182, -2.0007,  ..., -2.0357, -2.0182, -2.0357],
             [-2.0182, -2.0357, -2.0182,  ..., -2.0007, -2.0182, -2.0357],
             [-2.0007, -2.0357, -2.0182,  ..., -2.0182, -2.0357, -2.0007]],
    
            [[-1.5779, -0.7587,  0.3916,  ...,  0.1999,  0.2522,  0.2522],
             [-1.0724,  0.1651,  1.0017,  ...,  0.2696,  0.3393,  0.3219],
             [-0.2532,  0.7751,  1.0191,  ...,  0.3045,  0.4091,  0.4614],
             ...,
             [-1.8044, -1.8044, -1.8044,  ..., -1.8044, -1.7696, -1.7870],
             [-1.7870, -1.8044, -1.7696,  ..., -1.6999, -1.7173, -1.7696],
             [-1.7696, -1.7696, -1.7347,  ..., -1.6999, -1.7347, -1.6476]]])]

I have append 16 images of 3x112x112 shape, when I check shape of the images_set using this code;

print(np.array(images_set, dtype='object').shape)

I get;

(16,)

and then I check the shape of the first index of the image_set as it is 16 image then using this code;

print(np.array(images_set[0]).shape)

I get, each 16 image have this shape

(3, 112, 112) 

how can I make it to this shape `(16, 3, 112, 112)?

$\endgroup$
4
  • 2
    $\begingroup$ That is because you are appending tensors to a list, and since they are two different types at the top level the array is of shape (16,) whereas within each item the shape is (3, 112, 112). Instead of appending to the list you should use numpy.stack, or given that you are working with tensors, use the tensorflow/pytorch equivalent. $\endgroup$
    – Oxbowerce
    Commented Aug 9, 2021 at 7:34
  • $\begingroup$ the each image is in tensor format and then the all images together are in list. I know this, but how can I make it all for tensor only so that I can only read it as [16,3,112,112]? $\endgroup$ Commented Aug 9, 2021 at 7:37
  • $\begingroup$ Like I said, use the numpy.stack equivalent for the library you are working with, which would be tf.stack for tensorflow and torch.stack for pytorch. $\endgroup$
    – Oxbowerce
    Commented Aug 9, 2021 at 7:50
  • $\begingroup$ Okay, Okay, I got you. $\endgroup$ Commented Aug 9, 2021 at 7:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.