There are 2048 channels without the Conv layer in the middle of the CNN, and the shape is (7,7,2048). When calculating the total value of all channels, it is possible to do it with one image, but I do not know how to do it with multiple images (eg, 8 images (8,7,7,2048)).Data shape and code
print (layer_outputs.shape) # (8,7,7,2048) # After specifying the shape, pad h and w with zero. h, w, ch = layer_outputs.shape [1:] res = np.zeros ((h, w)) # 1 image can be extracted below for i in range (ch): img_res = layer_outputs [0 ,:,:, i] # 0 res = res + img_res #Trial with multiple images lst =  for i in range (ch): for n in range (len (layer_outputs)): img_res = layer_outputs [n,:,:, i] res = res + img_res lst.append (res) #The result is 16384 (8 * 2048), which is not classified by the number of images. np.array (lst) .shape # (16384, 7, 7)
img_res = layer_outputs [n,:,:, i] img_res = layer_outputs [n] [:,:, i] I tried it with, but the result was the same as above.
The desired shape is (8,7,7).
How can I calculate the total value for each image?
I would be grateful if you could teach me. Thank you.
Answer # 1
understood. I entered if I divided it into two stages. I apologize to you for a fuss over.
lst =  for img_idx in range (len (X)): layer_output = layer_outputs [img_idx] h, w, ch = layer_output.shape res = np.zeros ((h, w)) for i in range (ch): img_res = layer_output [:,:, i] res = res + img_res lst.append (res)
- python - read only the maximum value from multiple csv files and combine them into one file
- python - absolute value behavior of complex numbers in numpy
- python 3x - multiple outputs from a list of tuples
- i want to set the maximum value of the slider in python to the number entered in the text box
- python - how to output the key and value in the dictionary in any form
- sqlite - [sql] i want to get the total value for each condition using sql of access
- python - about multiple processing and loop processing in discordpy
- python 3x - how to get the value of scrolledtext
- python - data measurement by increasing the number of channels
- i want to get the value from a constant in python and display it
- i want to dynamically change the value of a variable in python and execute it
- python - read multiple audio files (wav files)
- (python) i want to convert multiple json files with different columns into one csv format
- put the maximum value of the list of variables in the objective function with python pulp
- ruby - output the total integer value held by each user
- python 3x - i want to save the value of a variable in memory
- python - judgment if the value is nan or not a valid url
- python 3x - the output result of the numerical value obtained by web scraping becomes 0
- python - i want to set a value in a column that has no value by scraping the table and output it as csv