I have an 3d array that looks like this With the shape (20001, 128, 128)
array([[[48, 48, 48, ..., 48, 48, 48],
[48, 48, 48, ..., 48, 48, 48],
[48, 48, 48, ..., 48, 48, 48],
...,
[[12, 12, 12, ..., 12, 12, 12],
[12, 12, 12, ..., 12, 12, 12],
[12, 12, 12, ..., 12, 12, 12],
...,
[19, 19, 19, ..., 12, 12, 12],
[19, 19, 19, ..., 19, 12, 12],
[19, 19, 19, ..., 19, 19, 19]],
And I have a dict that look like this
{1: [1, 39],
2: [2, 5, 9, 20, 32, 42, 47, 72, 88, 91, 95],
3: [3, 49, 55],
4: [4, 24, 34, 40, 53, 76, 81, 90, 96],
5: [6, 17, 30, 48, 83],
6: [7, 13, 15, 16, 27, 44, 51, 54, 56, 75],
7: [8, 50],
8: [10, 19, 22, 35, 61, 63, 65],
9: [11, 12, 21, 46, 52, 69, 78, 84, 89],
10: [14, 36, 74],
11: [18],
12: [23, 38, 66, 97],
13: [25],
14: [26, 28, 29, 62, 64, 86, 94],
15: [31, 59, 85],
16: [33, 80],
17: [37, 45, 60],
18: [41, 92, 93],
19: [43, 77, 79, 82],
20: [57, 67],
21: [58],
22: [68],
23: [70],
24: [71],
25: [73, 87],
0: [0]}
So what im after is that if the array value = dict value to change the array value to the key, like this ->
array([[[5, 5, 5, ..., 5, 5, 5],
[5, 5, 5, ..., 5, 5, 5],
[5, 5, 5, ..., 5, 5, 5],
...,
[9, 9, 9, ..., 9, 9, 9],
[9, 9, 9, ..., 9, 9, 9],
[9, 9, 9, ..., 9, 9, 9]],
...,
[8, 8, 8, ..., 9, 9, 9],
[8, 8, 8, ..., 8, 9, 9],
[8, 8, 8, ..., 8, 8, 8]],
Because 48 is in key 5, 12 is in key 9 etc