Normalize Pixel ValuesUnsolved
Problem reported in interviews at
The pixel value of images ranges between 0 to 255. While using these images in a neural network, they will have to be normalized to be in the range of 0 to 1. This can be performed by dividing all pixel values by the largest pixel value.
Write a function normalize(image) which takes in an input grayscale image (2D NumPy array) and returns the normalized pixel values.
image: [[ 1 7 9 13 12] [11 21 61 81 91] [ 5 66 6 5 5]]
[[0.00392157 0.02745098 0.03529412 0.05098039 0.04705882] [0.04313726 0.08235294 0.23921569 0.31764707 0.35686275] [0.01960784 0.25882354 0.02352941 0.01960784 0.01960784]]
This is a premium problem, to view more details of this problem please sign up for MLPro Premium. MLPro premium offers access to actual machine learning and data science interview questions and coding challenges commonly asked at tech companies all over the world
MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.
Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro
Get access to Premium only exclusive educational content available to only Premium users.
Have an issue, the MLPro support team is available 24X7 to Premium users.
This is a premium feature.
To access this and other such features, click on upgrade below.
Log in to post a commentComments
Input Test CasePlease enter only one test case at a time
numpy has been already imported as np (import numpy as np)