Code for HLA-Face: Joint High-Low Adaptation for Low Light Face Detection (CVPR21)

Overview

HLA-Face: Joint High-Low Adaptation for Low Light Face Detection

The official PyTorch implementation for HLA-Face: Joint High-Low Adaptation for Low Light Face Detection (CVPR21).

You can find more information on our project website.


1. Description

Our face detection mAP on DARK FACE test set (trained without DARK FACE labels): 44.4

Precision-Recall (PR) curves on DARK FACE.

Comparison-Results

2. Training code

Please follow [Training Code] to download and prepare the dataset.

Basically, to train the final Joint High-Low Adaptation framework

cd ./train_code
python train.py --multigpu

More details are given in [Training Code].

3. Testing code

First, download and cd ./test_code.

3.1 Requirements

  • Python 3

  • PyTorch 1.2.0

    • Higher versions may cause the RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method bug.

    • According to https://github.com/yxlijun/DSFD.pytorch, PyTorch 0.3 is also OK, but we have not checked it.

  • opencv

  • numpy

  • easydict

3.2 Demo

Download the checkpoints from [Google] [Baidu (xnb6)], and save them as:

./final_weights/Illumination-Enhancer.pth
./final_weights/Face-Detector.pth

This script detects the example test.png image.

python test.py

The detection result (a text file) can be found in ./result/ and visualized by draw_result.py

Here, the left image is test.png, and the right image is the visualized face detection result.

test

3.3 Test more images

You can further edit the function load_images() in test.py to load your testing images. The detection results can be found in ./result where each detection result is named by the name of the testing image.

For example, to test the DSFD test dataset:

def load_images():
    import glob
    return glob.glob('./YOUR_PATH_TO_DARKFACE/images/test/*.png')

If you want to run without the multi-scale testing scheme (the mode we used in ablation studies), set:

USE_MULTI_SCALE = False
MY_SHRINK = 2

This code is based on DSFD. Thanks a lot for the great work!

Comments
  • Unable to replicate train brightening

    Unable to replicate train brightening

    Hi, thanks for your nice work. I am trying to replicate the results from the train_brightening procedure, however, I am unable to recreate the visual results of the enhanced data that you are providing. My enhanced saved images are much more noisy.

    opened by gkagkos 8
  • DarkFace Train/Val Split

    DarkFace Train/Val Split

    Hi, thanks for your great work! I want to know how you split DarkFace in to train&val set. Specifically, which 500 images are selected as val images? Moreover, are models in Table. 1 in the paper evaluated on val set or test set? Looking forward to your reply, 3Q!

    opened by yanqinJiang 5
  • How to calculate the metrics?

    How to calculate the metrics?

    Hello, amazing work, thanks for sharing the code, I have one question

    It seems the test.py just save the detection results in a file, can you please tell me how to mAP value?

    opened by JunrQ 5
  • RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM

    RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM

    Hello, when I run "python train.py --multigpu" with 4 GPUs in pytorch1.7, I meet the following error, Traceback (most recent call last): File "train.py", line 403, in loss.backward() File "/root/anaconda3/lib/python3.7/site-packages/torch/tensor.py", line 221, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/root/anaconda3/lib/python3.7/site-packages/torch/autograd/init.py", line 132, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM You can try to repro this exception using the following code snippet. If that doesn't trigger the error, please include your original repro script when reporting this issue.

    import torch torch.backends.cuda.matmul.allow_tf32 = True torch.backends.cudnn.benchmark = False torch.backends.cudnn.deterministic = False torch.backends.cudnn.allow_tf32 = True data = torch.randn([2, 64, 4, 4], dtype=torch.float, device='cuda', requires_grad=True) net = torch.nn.Conv2d(64, 64, kernel_size=[3, 3], padding=[1, 1], stride=[1, 1], dilation=[1, 1], groups=1) net = net.cuda().float() out = net(data) out.backward(torch.randn_like(out)) torch.cuda.synchronize() ConvolutionParams data_type = CUDNN_DATA_FLOAT padding = [1, 1, 0] stride = [1, 1, 0] dilation = [1, 1, 0] groups = 1 deterministic = false allow_tf32 = true input: TensorDescriptor 0x7f2944305e20 type = CUDNN_DATA_FLOAT nbDims = 4 dimA = 2, 64, 4, 4, strideA = 1024, 16, 4, 1, output: TensorDescriptor 0x7f2944321900 type = CUDNN_DATA_FLOAT nbDims = 4 dimA = 2, 64, 4, 4, strideA = 1024, 16, 4, 1, weight: FilterDescriptor 0x7f29442f7740 type = CUDNN_DATA_FLOAT tensor_format = CUDNN_TENSOR_NCHW nbDims = 4 dimA = 64, 64, 3, 3, Pointer addresses: input: 0x7f267b5fd400 output: 0x7f267d77ba00 weight: 0x7f27d7b2f600 Additional pointer addresses: grad_output: 0x7f267d77ba00 grad_weight: 0x7f27d7b2f600 Backward filter algorithm: 3

    Have you ever encountered this bug?

    opened by xuebaliang 1
  • UG2+ Track1.2

    UG2+ Track1.2

    I want to test the effect on CodaLab, but prompt Submission upload has had been disabled. See the new instance at: https://codalab.lisn.upsaclay.fr/. I can't find the same item in the new site, how do I test it? Thank you

    opened by zhebawomenjiuyaochangshenle 3
  • help :Seek exdark datasets

    help :Seek exdark datasets

    You want to try to reproduce your code, but you can't find the ExDark dataset corresponding to your exdark_test.txt. You can package and send me a complete exdark dataset and .txt. Type of tag file? Email:[email protected], thank you very much.

    opened by TXM-SB 0
  • The loss does not converge during training

    The loss does not converge during training

    During the pre-training of the classification head and the comparison learning head, as well as during the Joint High-Low Adaptation training, the loss does not converge and oscillates repeatedly. Can you provide me with your gradient descent curve?

    opened by celiazzx 0
  • When do Validation

    When do Validation

    Have you met this problem?

    self.queue[ind, :, ptr:ptr + batch_size] = keys.T RuntimeError: The expanded size of the tensor (6) must match the existing size (16) at non-singleton dimension 1. Target sizes: [128, 6]. Tensor sizes: [128, 16]

    opened by celiazzx 1
Owner
Wenjing Wang
Wenjing Wang
Official code of "R2RNet: Low-light Image Enhancement via Real-low to Real-normal Network."

R2RNet Official code of "R2RNet: Low-light Image Enhancement via Real-low to Real-normal Network." Jiang Hai, Zhu Xuan, Ren Yang, Yutong Hao, Fengzhu

null 77 Dec 24, 2022
[CVPR21] LightTrack: Finding Lightweight Neural Network for Object Tracking via One-Shot Architecture Search

LightTrack: Finding Lightweight Neural Networks for Object Tracking via One-Shot Architecture Search The official implementation of the paper LightTra

Multimedia Research 290 Dec 24, 2022
Repository relating to the CVPR21 paper TimeLens: Event-based Video Frame Interpolation

TimeLens: Event-based Video Frame Interpolation This repository is about the High Speed Event and RGB (HS-ERGB) dataset, used in the 2021 CVPR paper T

Robotics and Perception Group 544 Dec 19, 2022
Official repository for CVPR21 paper "Deep Stable Learning for Out-Of-Distribution Generalization".

StableNet StableNet is a deep stable learning method for out-of-distribution generalization. This is the official repo for CVPR21 paper "Deep Stable L

null 120 Dec 28, 2022
Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.

face3d: Python tools for processing 3D face Introduction This project implements some basic functions related to 3D faces. You can use this to process

Yao Feng 2.3k Dec 30, 2022
Adversarial Adaptation with Distillation for BERT Unsupervised Domain Adaptation

Knowledge Distillation for BERT Unsupervised Domain Adaptation Official PyTorch implementation | Paper Abstract A pre-trained language model, BERT, ha

Minho Ryu 29 Nov 30, 2022
Joint detection and tracking model named DEFT, or ``Detection Embeddings for Tracking.

DEFT: Detection Embeddings for Tracking DEFT: Detection Embeddings for Tracking, Mohamed Chaabane, Peter Zhang, J. Ross Beveridge, Stephen O'Hara

Mohamed Chaabane 253 Dec 18, 2022
Code for "LoRA: Low-Rank Adaptation of Large Language Models"

LoRA: Low-Rank Adaptation of Large Language Models This repo contains the implementation of LoRA in GPT-2 and steps to replicate the results in our re

Microsoft 394 Jan 8, 2023
The code release of paper Low-Light Image Enhancement with Normalizing Flow

[AAAI 2022] Low-Light Image Enhancement with Normalizing Flow Paper | Project Page Low-Light Image Enhancement with Normalizing Flow Yufei Wang, Renji

Yufei Wang 176 Jan 6, 2023
The code of Zero-shot learning for low-light image enhancement based on dual iteration

Zero-shot-dual-iter-LLE The code of Zero-shot learning for low-light image enhancement based on dual iteration. You can get the real night image tests

null 1 Mar 18, 2022
A light and fast one class detection framework for edge devices. We provide face detector, head detector, pedestrian detector, vehicle detector......

A Light and Fast Face Detector for Edge Devices Big News: LFD, which is a big update of LFFD, now is released (2021.03.09). It is strongly recommended

YonghaoHe 1.3k Dec 25, 2022
Code for BMVC2021 "MOS: A Low Latency and Lightweight Framework for Face Detection, Landmark Localization, and Head Pose Estimation"

MOS-Multi-Task-Face-Detect Introduction This repo is the official implementation of "MOS: A Low Latency and Lightweight Framework for Face Detection,

null 104 Dec 8, 2022
The implementation for paper Joint t-SNE for Comparable Projections of Multiple High-Dimensional Datasets.

Joint t-sne This is the implementation for paper Joint t-SNE for Comparable Projections of Multiple High-Dimensional Datasets. abstract: We present Jo

IDEAS Lab 7 Dec 18, 2022
Open source code for Paper "A Co-Interactive Transformer for Joint Slot Filling and Intent Detection"

A Co-Interactive Transformer for Joint Slot Filling and Intent Detection This repository contains the PyTorch implementation of the paper: A Co-Intera

null 67 Dec 5, 2022
Byte-based multilingual transformer TTS for low-resource/few-shot language adaptation.

One model to speak them all ?? Audio Language Text ▷ Chinese 人人生而自由,在尊严和权利上一律平等。 ▷ English All human beings are born free and equal in dignity and rig

Mutian He 60 Nov 14, 2022
From Fidelity to Perceptual Quality: A Semi-Supervised Approach for Low-Light Image Enhancement (CVPR'2020)

Under-exposure introduces a series of visual degradation, i.e. decreased visibility, intensive noise, and biased color, etc. To address these problems, we propose a novel semi-supervised learning approach for low-light image enhancement.

Yang Wenhan 117 Jan 3, 2023
Tensorflow implementation of MIRNet for Low-light image enhancement

MIRNet Tensorflow implementation of the MIRNet architecture as proposed by Learning Enriched Features for Real Image Restoration and Enhancement. Lanu

Soumik Rakshit 91 Jan 6, 2023
LLVIP: A Visible-infrared Paired Dataset for Low-light Vision

LLVIP: A Visible-infrared Paired Dataset for Low-light Vision Project | Arxiv | Abstract It is very challenging for various visual tasks such as image

CVSM Group -  email: czhu@bupt.edu.cn 377 Jan 7, 2023
Official implementation for "Low-light Image Enhancement via Breaking Down the Darkness"

Low-light Image Enhancement via Breaking Down the Darkness by Qiming Hu, Xiaojie Guo. 1. Dependencies Python3 PyTorch>=1.0 OpenCV-Python, TensorboardX

Qiming Hu 30 Jan 1, 2023