# Restore original images from X\_test processed using \`imagenet\_utils.preprocess\_input\`

**URL:** <https://discuss.ai.google.dev/t/restore-original-images-from-x-test-processed-using-imagenet-utils-preprocess-input/109054>\
**Category:** Keras\
**Tags:** tfimage, api\
**Created:** [November 7, 2025, 8:25am UTC](https://discuss.ai.google.dev/t/restore-original-images-from-x-test-processed-using-imagenet-utils-preprocess-input/109054 "2025-11-07T08:25:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khteh](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/khteh/32/61930_2.png) [@khteh](https://discuss.ai.google.dev/u/khteh)\
**Post date:** [November 7, 2025, 8:25am UTC](https://discuss.ai.google.dev/t/restore-original-images-from-x-test-processed-using-imagenet-utils-preprocess-input/109054/1 "2025-11-07T08:25:57Z")

</div>

I have train, validation and test datasets from the original corpora of images. Some of these images are grascale, some RGB and the grayscale images are converted to RGB using `tf.image.grayscale_to_rgb(image)`. These images are then processed using `tf.keras.applications.resnet_v2.preprocess_input`. I need to evaluate using the test dataset and show the result by plotting the images. How to restore those images which have been processed? The challenge here is to undo/reverse the operation done by both of these library functions.

---

<div class="post-metadata">

**Author:** ![Divya\_Sree\_Kayyuri](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/divya_sree_kayyuri/32/29791_2.png) [@Divya\_Sree\_Kayyuri](https://discuss.ai.google.dev/u/Divya_Sree_Kayyuri)\
**Post date:** [December 1, 2025, 6:37am UTC](https://discuss.ai.google.dev/t/restore-original-images-from-x-test-processed-using-imagenet-utils-preprocess-input/109054/3 "2025-12-01T06:37:34Z")

</div>

Hi @khteh, You can restore those images, with reversed preprocessing formula - `(preprocessed + 1.0) * 127.5` . Thanks!
