Downloads · 30 days
0
jessicanono/filparty_colorization
filparty_colorization is a machine learning model from jessicanono. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Welcome to the GitHub repository for our Image Colorization model! This model uses deep learning to add vibrant colors to grayscale images, particularly focusing on historical photographs. Below you'll find instructio…
Downloads · 30 days
0
Access
Public
Updated Nov 25, 2023
Repo size
7.7 MB
Likes
0
Public
Click a slice to open those files.
.pth3.9 MB · 100%
From the Hugging Face model README
Welcome to the GitHub repository for our Image Colorization model! This model uses deep learning to add vibrant colors to grayscale images, particularly focusing on historical photographs. Below you'll find instructions on how to set up and use this model.
To use this model, you need the following:
You can install the necessary libraries using pip:
pip install torch torchvision Pillow scikit-image matplotlib numpy
ColorizationNet is a neural network model built using PyTorch. It combines the power of ResNet and an upsampling network to colorize grayscale images.
First, clone this repository and navigate to the directory:
git clone [repo-link]
cd [repo-directory]
Download the trained model weights (colorization_md1.pth) and place them in the repository's root directory.
To colorize an image, follow these steps:
Prepare the Image: Ensure your image is in grayscale format. You can use any standard image format like JPG or PNG.
Run the Model: Use the following code to colorize your image.
from colorize import ColorizationNet, colorize_single_image
import torch
import torch.nn as nn
# Load the model
model = ColorizationNet()
model_path = 'colorization_md1.pth'
pretrained = torch.load(model_path, map_location=lambda storage, loc: storage)
model.load_state_dict(pretrained)
model.eval() # Set the model to evaluation mode
# Set the path to your image
image_path = 'path_to_your_image.jpg'
save_dir = 'dir_to_save_colorized_image'
criterion = nn.MSELoss()
# Colorize the image
use_gpu = torch.cuda.is_available()
colorize_single_image(image_path, model, criterion, save_dir, epoch=0, use_gpu=use_gpu)
View the Results: The colorized image will be saved in the specified save_path. You will find both the original grayscale and the colorized version there.
Feel free to contribute to this project by submitting pull requests. If you encounter any issues or have questions, please submit them in the issues section of this repository.
Enjoy exploring the vibrant colors of history with our model! 🎨📸