I have few questions to ask related to neural networks.
The first one is how we get expected category (target) using argmax() .
The second one is how we can get the pixel values of any image that is used as an input in neural networks
Argmax outputs the highest probability output (class present in your model). As you might know, Machine Learning models are probabilistic models and they output probabilities of each class being present in the input.
These image pixels already have number representations in the digital format; you just need to extract them, and there are many functions or libraries to do that. For example this code will read from .jpg and will convert to a numpy array (keep in mind that every pixel has a value from 0 to 255 depending on density and could also have 3 channels (RBG)):
from PIL import Image
import numpy as np
# Open the image file
image = Image.open("your_image.jpg")
# Convert to a NumPy array
numpy_array = np.array(image)
# Print the shape of the array
print(numpy_array.shape)
Thanks
As Gent says, the pixel values are just given to you: that’s what an input image consists of. But one additional point worth mentioning is that you will usually see that we can get better convergence by normalizing the pixel values before using the images in training and inference. The most common way to do that is simply to divide all the pixel values by 255, so that they end up being floating point values between 0 and 1 rather than unsigned 8 bit integers. Most image libraries will automatically handle rendering images that have been rescaled in that way.