This project is designed to depixelate images using machine learning. The primary objective is to predict the original values of pixelated regions within images.
-
Clone the Repository
git clone https://github.com/ProstoPonchik/img-depixelation.git
-
Install Dependencies
- Ensure you have the necessary Python libraries and dependencies installed. This project is optimized for NVIDIA GPUs with CUDA cores. It does not work on CPU by default, but you can modify it if required.
- Install the required libraries from
requirements.txt:pip install -r requirements.txt
-
Download and Extract Data
- Download
images_for_training.zipfrom the project's GitHub repository. - Extract the images:
unzip images.zip
- Download
-
Set Up Training Data Path
- Before training, you need to specify the path to your images in the
train_model.pyfile:dataset = RandomImagePixelationDataset( r"your_path_to_images", width_range=(4, 32), height_range=(4, 32), size_range=(4, 16) )
Replace
your_path_to_imageswith the path to your extracted images. - Before training, you need to specify the path to your images in the
- Train the Neural Network
Use the
train_model.pyscript to train your model. As mentioned, it's optimal to run this on NVIDIA GPUs with CUDA cores for performance reasons.python3 train_model.py
-
Generate Predictions Use the
test_model.pyscript to see the results of your trained model. Example usage is provided within the file. -
Evaluating Model Accuracy with Test Set
- First, you'll need to serialize your predictions using
submission_serialization.py:from a7_ex1 import produce_predictions predictions = produce_predictions("v4/model.pth", "v4/best_model_weights_validation.pth", "test_set.pkl") serialize(predictions, 'pudg.bin')
- Then, use the provided
scoring.pyscript to compute the RMSE:python3 scoring.py --submission ****.bin --target target.data
- First, you'll need to serialize your predictions using
- Always ensure you're using the correct image sets.
images_for_training.zipshould be used for training, whiletest.zipis for model accuracy testing. - The project is optimized for NVIDIA GPUs with CUDA cores due to performance benefits. If you attempt to run it on a CPU, modifications may be needed.
- Use the provided scripts as outlined to ensure correct model training, testing, and scoring.
- The project automatically converts images to the required format.
If you encounter any issues or have questions about specific parts of the project, refer to the detailed instructions provided in the original assignment or reach out to the project maintainers on GitHub.
This documentation provides a comprehensive guide on how to use the Image Depixelation project hosted on GitHub. Always ensure you follow the steps sequentially and refer back to the documentation if you encounter any challenges.