Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/praneetneuro/convolutional-autoencoder-for-image-transformation
Can be used to build autoencoder models for image transformation like image colorization
https://github.com/praneetneuro/convolutional-autoencoder-for-image-transformation
Last synced: 7 days ago
JSON representation
Can be used to build autoencoder models for image transformation like image colorization
- Host: GitHub
- URL: https://github.com/praneetneuro/convolutional-autoencoder-for-image-transformation
- Owner: PraneetNeuro
- License: mit
- Created: 2021-01-10T13:42:04.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-18T07:34:52.000Z (almost 4 years ago)
- Last Synced: 2024-05-14T00:22:59.613Z (6 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Convolutional-Autoencoder-for-Image-transformation
Can be used to build autoencoder models for image transformation like image colorization# Note:
Feel free to tinker with the source file to work with images of different dimensions## Sample code for training the model and inference
```python
dataset = Dataset('SRC_IMAGES_PATH', 'TARGET_IMAGES_PATH')
autoencoder = AutoEncoder(dataset, epochs=35)def inference(images_path, save_path, ground_truth_path=None):
if ground_truth_path is not None:
for img_n in tqdm(os.listdir(images_path)):
try:
img = cv2.imread(images_path + img_n)
img_ = np.array(cv2.resize(img, (100, 100))) / 255
img = np.expand_dims(img_, 0)
output = np.array(autoencoder.model.predict([np.array(img)])[0])
target = cv2.imread(ground_truth_path + img_n)
target = np.array(cv2.resize(target, (100, 100)))
res = np.concatenate((img_ * 255, output * 255, target), axis=1)
cv2.imwrite('{}/generated_{}.jpg'.format(save_path, os.path.splitext(img_n)[0]), res)
except:
pass
else:
output = np.array(autoencoder.model.predict([np.array(img)])[0])
cv2.imwrite('{}/generated_{}.jpg'.format(save_path, os.path.splitext(img_n)[0]), output)
```