What is MinMaxScaler in Python
Why does MinMaxScaler add lines to the image? - numpy, image processing, machine learning, scikit-learning
I want to normalize the pixel values of an image for each channel (R, G, B) to the range [0, 1].
Take https://commons.wikimedia.org/wiki/File:Crocodylus-johnsoni-3.jpg, I get the following "normalized" result:
As you can see there are lines going from top to bottom on the right. What happened there? It seems to me that the normalization went wrong. If so, how do I fix it?
Reply:4 for the answer № 1
In scikit-learn, a two-dimensional array with shape (m, n) is usually interpreted as a collection of m Have samples, with every sample n Properties.
transforms everyone featureso that each column of your array is transformed independently of the others. This leads to the vertical "stripes" in the picture.
It looks like you intend to scale each color channel independently. To do that, change the input so that each channel becomes a column. That is, if the original image is of the shape (m, n, 3) it will be reshaped to (m * n, 3) before being passed to the method and then restore the shape of the result to the create transformed array.
With this one, looks like this:
The image looks exactly like the original, because that results in the array.The minimum and maximum are 0 and 255 in each channel:
So everything In this case, transform all input values to the floating point area [0.0, 1.0] uniformly. If the minimum or maximum in one of the channels were different, the transformed image would look different.
By the way, it's not difficult to do transform with pure numpy. (I'm using Python 3 so in the following case the result is automatically converted to floating point numbers. If you are using Python 2 you will need to convert or use one of the arguments to floating point numbers.)
(A possible problem with this method is that if one of the channels is constant it will generate an error because then one of the values in becomes 0.)
- How do you start a music label
- Are fragrant oils different from essential oils
- Why does mobile communications cost so much
- Can I get into MIT or Caltech
- Does the use of SSRI affect the IQ
- What does drinking do to your stomach
- What is your experience with ThredUP?
- Which bands are more unique than Apocalyptica
- How do spiders mate
- How do planes track and destroy submarines?
- Sachin Tendulkar is a leader
- Why do some reptiles look intelligent
- How are Hornfels formed
- Is Quora's Android App built with Phonegap
- Expires the debt of a traffic ticket
- What is Sericulture in India
- What is an area map
- What not to do after singing karaoke
- How do romance cheaters see their victims
- What are the coating materials in PVD
- Which is the cheapest 5G phone right now
- Did YouTube rewire your brain
- What is this picture font
- What you know about Abu Dhabi
- What's so good about Tik Tok
- Why is Lenovo killing Motorola
- What is the least attractive IT job
- How are ramen shops in Tokyo
- How many people don't use Google
- What happened to the hippies
- Should I give them up 3
- What influences engagement on LinkedIn
- Who are the Kree in Captain Marvel
- How do INTJs experience emotions