Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I ran a frame through neural style transfer with MobileSSD. Here is a picture of the problem I am running into, the middle one is the one producing the weird glares: enter image description here You must normalize the data like this to perform forward propagation with MobileSSD:

               (h, w) = noise_picture.shape[:2]

                blob2 = cv2.dnn.blobFromImage(noise_picture, 1.0, (w, h), (103.939, 116.779, 123.680), swapRB=False, crop=False)
                NTSnet.setInput(blob2)
                output = NTSnet.forward()
                output = output.reshape((3, output.shape[2], output.shape[3]))
                output[0] += 103.939
                output[1] += 116.779
                output[2] += 123.680
                output /= 255.0
                output = output.transpose(1,2,0)

The weird thing is that if I were to imshow this output thing, which is divided all by 255 (and thus between [0,1], it will show the right most picture in my 3 pictures. But if I add it to a pitch black image with:

black_background[startY:endY, startX:endX] = output

And if I imshow black_background, it wouldn't work even though the range of values should also be [0,1]. However, when I do

black_background[startY:endY, startX:endX] = output * 255

Which unnormalizes the data (correct me if I am wrong). It does work, but it shows the middle picture with the weird glare, any insights? Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
214 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...