DehazeFormer
DehazeFormer is a deep learning model designed for single image haze removal. Leveraging a transformer-based architecture, it effectively restores image clarity and contrast by removing haze, making it suitable for applications in autonomous driving, remote sensing, and image enhancement.
DehazeFormer

Summary
Introduction
DehazeFormer is a state-of-the-art deep learning model designed for single image dehazing, aiming to restore image clarity and enhance visual quality under hazy conditions. Built upon a powerful transformer-based architecture, DehazeFormer leverages long-range spatial dependencies to better model the complex degradation caused by atmospheric haze. Unlike traditional convolutional neural networks (CNNs), the transformer backbone allows the model to capture global context more effectively, resulting in more accurate haze removal and better preservation of structural details and colors.
To further improve performance on real-world hazy images, the model is trained on a mixed dataset that combines both synthetic and real hazy images. This enables DehazeFormer to generalize well across various scenarios, including outdoor scenes, natural landscapes, and urban environments. Additionally, to handle high-resolution inputs efficiently, the model is extended to support the MCT (Multi-Chunk Transformer) variant, which allows it to process large images without excessive memory consumption while maintaining high-quality outputs.
DehazeFormer is suitable for a wide range of applications, such as autonomous driving, surveillance, aerial photography, and satellite imaging, where clear visibility is critical. With its robust architecture and excellent dehazing performance, DehazeFormer represents a significant advancement in the field of image restoration and enhancement.
Parameters
Inputs
input_image- (image -.png|.jpg|.jpeg): A single hazy image to be processed by the model. The image can be of any outdoor scene affected by haze, fog, or low visibility conditions.
Output
output_image- (image -.png): The resulting dehazed image, where the haze has been removed and the visual clarity, contrast, and colors have been restored. The output image maintains the same resolution as the input.
Examples
| input_image | output_image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
Usage for developers
Please find below the details to track the information and access the code for processing the model on our platform.
Requirements
pip install -r requirements.txt
Code based on AIOZ structure
from PIL import Image
from .dehazeformer import MCT
...
def do_ai_task(
input: Union[str, Path],
model_storage_directory: Union[str, Path],
device: Literal["cpu", "cuda", "gpu"] = "cpu",
*args, **kwargs) -> Any:
"""Define AI task: load model, pre-process, post-process, etc ..."""
# Define AI task workflow. Below is an example
device = "cuda" if torch.cuda.is_available() else "cpu"
model_id = os.path.abspath(model_storage_directory + '...')
network = MCT()
network.load_state_dict(torch.load(model_id, map_location=torch.device(device))['state_dict'])
network.eval()
raw_image = Image.open(input_image)
image = np.array(raw_image, np.float32) / 255. * 2 - 1
image = torch.from_numpy(image)
image = image.permute((2, 0, 1)).unsqueeze(0)
with torch.no_grad():
output = network(image).clamp_(-1, 1)[0] * 0.5 + 0.5
output = output.permute((1, 2, 0))
output = np.array(output, np.float32)
output = np.round(output * 255.0)
output = Image.fromarray(output.astype(np.uint8))
output.save("output.png")
output_image = open("output.png", "rb") # io.BufferedReader
return output_image
return output
Reference
This repository is based on and inspired by Yuda Song's work. We sincerely appreciate their generosity in sharing the code.
License
We respect and comply with the terms of the author's license cited in the Reference section.
Citation
@inproceedings{song2022multi,
title={Multi-Curve Translator for High-Resolution Photorealistic Image Translation},
author={Song, Yuda and Qian, Hui and Du, Xin},
booktitle={European Conference on Computer Vision},
pages={126--143},
year={2022}
}





