![]() #Tensorflow image resize code#It seems strange that there is a displacement between the two images, completely contrary to any logic, this is impossible! My code is actually very simple, read the image, crop the image, adjust the image size, all operations are performed in TensorFlow. I directly ignored the output of the network, and superimposed the target image and the input image (ie the reduced target image) in Photoshop. Almost subconsciously I feel that there is a problem with the image. Just yesterday, I found a bug while checking Tensorboard. Each training takes several days to get meaningful results. I even adjusted perceptual losses and style losses to find out why. I even suspect GPU memory and static defects. Switch TF1.3→1.4→1.5 and different CUDA versions. I adjusted everything I could think of, using Keras, Slim, using native TensorFlow-nothing useful. My logic is very simple-there is a problem in the definition of the network structure or the training process, and there is absolutely no problem with the data processing, because I visualized the image processing process and results in Tensorboard. I struggled with this seemingly small bug for 60 days. The ugliest part is that the results of super-resolution itself are sometimes very good, indicating that the network is working, although it does not meet the PSNR target, sometimes there are some strange visual products, such as the multiplication of small lines. The problem has arisen-the super-resolution model trained by my new code is not only state-of-art, but not as good as the one I wrote 4 months ago. ![]() Therefore, I decided to stick to the dataset.map() function and put all the image processing operations into it. I always doubt whether it is reasonable to use TensorFlow image processing functions-in theory, they should be faster. ![]() In order to enhance the neural network for image recognition, make it faster, larger, and prepare for the API under development, I am rewriting this part of the code base, as we used to deal with image generation tasks (super resolution, go Blur, etc.), we do rely on typical image processing libraries like OpenCv and PIL. This is a short warning to all computer vision workers: do not use any tf.image.resize functions! When I switched to manually unpacking the shape from tf.shape(), everything worked fine.How Tensorflow's tf.image.resize stole 60 days of my life Consider casting elements to a supported type. ![]() TypeError: Failed to convert object of type to Tensor. I was using shape dimensions downstream in my dataset.map() function and it threw the following exception because it was getting None instead of a value. Tensorflow graph execution does not seem to support access to the tensor.shape tuple. My error was in the way I was unpacking the shape of the image to get dimensions for scaling. Apparently, in that execution environment, tf.executing_eagerly()=False. tf.executing_eagerly()=True but failed when used within dataset.map(). It had to do with the fact that my resize method worked fine with eager execution, e.g. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |