Reviving DPED: Breathing New Life into a Classic Deep Photo Enhancement Project

Reviving DPED: Breathing New Life into a Classic Deep Photo Enhancement Project

Hello, tech enthusiasts! Today, we’re diving into the world of deep learning for image enhancement by revisiting the DPED (Deep Photo Enhancement Dataset) project. Developed in 2017, DPED was a pioneering effort to bridge the gap between smartphone and DSLR photo quality using neural networks. With AI-powered photo enhancement now standard in most smartphones, you might wonder: why bother reviving an older project like DPED? Let’s explore the answer, walk through updating and running DPED on modern systems, and see how it holds up against today’s standards.


What is DPED?

DPED is an open-source project and dataset designed to train deep learning models to enhance smartphone photos to DSLR-like quality. The original team used paired images—photos taken simultaneously with smartphones (Sony Xperia Z, iPhone 3GS, BlackBerry Passport) and a Canon EOS 70D DSLR—to teach a neural network how to improve mobile images.

Key Features of DPED:

  • Structural Enhancement: Goes beyond simple filters, improving detail, dynamic range, and color accuracy.
  • Open Dataset & Code: Freely available for research and development, making it ideal for experimentation and further improvements.
  • Transparent Architecture: Easy to adapt and extend for new experiments or integration into mobile apps.

Despite being nearly a decade old, DPED remains competitive and relevant, especially as a benchmark for comparing new models and techniques.


Why Revive DPED Now?

  • Benchmarking: It provides a clear baseline to measure progress in AI photo enhancement.
  • Experimentation: Its open nature allows for easy modification and testing with new datasets or hardware.
  • Educational Value: Great for learning about deep learning pipelines in image processing.

Getting Started: Preparing to Run DPED

Running DPED on modern hardware and libraries isn’t plug-and-play. Over the years, Python and its libraries have evolved, leading to compatibility issues. Here’s how you can set up DPED today:

1. Clone the Repository

git clone https://github.com/aiff22/DPED

2. Understand the Project Structure

After cloning, you’ll see a directory structure like this:

DPED/
├── dped/
├── models/
├── models_orig/
├── vgg_pretrained/
├── ... (other scripts and folders)

3. Download Required Resources

  • Pretrained VGG-19 Model: Download from ETH Zurich and place it in vgg_pretrained/.
  • DPED Dataset: Download the patch dataset from here. Patches are small paired image crops (e.g., 100×100 pixels) from both smartphone and DSLR photos, used for efficient training.

Tip: For the full dataset (54GB+), use git lfs instead of a browser to avoid interrupted downloads. Note that git lfs may require up to 134GB of free space due to object copies.

4. Unpack the Dataset

Extract the patches into the dped/ folder. You should see subfolders for sony, iphone, and blackberry, each containing training and test data.

5. Update Dependencies

DPED was built for older Python and library versions. To run it on Python 3.11 and modern libraries:

  • Replace deprecated functions (e.g., scipy.misc.imread) with alternatives like imageio.imread.
  • Update image saving logic to convert float32 arrays to uint8 before saving with Pillow.
  • Adjust batch_size if you encounter GPU memory errors.

Running the Pretrained Model

To quickly test DPED, use the pretrained models provided in the repository:

  1. Run the Test Script:

    • Execute test_model.py to enhance sample images.
    • If you encounter errors saving images, ensure pixel values are clipped to [0, 1], scaled to [0, 255], and cast to uint8.
  2. Sample Output:

    • The script will save enhanced images for visual comparison.

Training Your Own Model

Want to retrain DPED or fine-tune it on new data? Here’s what to watch out for:

  • Library Compatibility:

    • If you see errors like scipy.misc.imread missing, switch to imageio.imread.
    • Ensure all dependencies are compatible with your Python version.
  • GPU Memory:

    • Training is VRAM-intensive. If you get out-of-memory errors, reduce batch_size in the training script.
    • Example: On an Nvidia RTX 3060 Ti (8GB VRAM), lowering batch_size from 50 to 35 resolved memory issues.
  • Training Stability:

    • Smaller batch sizes can make training less stable and affect metrics like SSIM (Structural Similarity Index) and PSNR (Peak Signal-to-Noise Ratio). Adjust learning rates or increase epochs if needed.
  • Metrics:

    • After training, compare your SSIM and PSNR scores to the original paper’s results to gauge performance.

Real-World Test: Enhancing Tablet Photos

To put DPED to the test, we enhanced photos taken with a modern tablet (YADRO KVADRA_T). The results showed clear improvements in detail and color, demonstrating that even an updated version of DPED can still deliver impressive results on new devices.


The Value of DPED Today

DPED remains a valuable tool for:

  • Research: Benchmarking and experimenting with new architectures or datasets.
  • Education: Understanding the evolution of deep learning in image processing.
  • Development: Building or improving open-source photo enhancement solutions.

Its transparent, open architecture makes it easy to track how changes in data, model, or hardware affect results—something not always possible with proprietary smartphone algorithms.


Conclusion & Tips

Reviving DPED is more than a nostalgia trip—it’s a practical exercise in adapting legacy deep learning projects to modern environments. Here are some takeaways:

  • Expect Compatibility Issues: Be ready to update code for new library versions.
  • Monitor GPU Usage: Adjust batch sizes to fit your hardware.
  • Leverage Open Source: Use DPED as a foundation for your own experiments or applications.
  • Stay Curious: Comparing classic models with today’s solutions can yield valuable insights.

We’re continuing to update DPED for modern workflows and plan to release a dedicated branch with all changes, installation instructions, and improved compatibility. Stay tuned for our next article, where we’ll share more results and insights!

What do you think about using DPED today? Is it worth reviving classic AI projects, or should we focus solely on new solutions? Share your thoughts below!