Git Product home page Git Product logo

dirl-inharmonious-region-localization's Introduction

Inharmonious Region Localization


Introduction

This is the official code of the following paper:

Inharmonious Region Localization (DIRL)
Jing Liang, Li Niu, Liqing Zhang
MoE Key Lab of Artificial Intelligence, Shanghai Jiao Tong University
(ICME 2021 | Bibtex)

Our latest research on Inharmonious Region Localization was accepted by AAAI 2022:

Inharmonious Region Localization by Magnifying Domain Discrepancy (MadisNet)
Jing Liang1, Li Niu1, Penghao Wu1, Fengjun Guo2, Teng Long2
1MoE Key Lab of Artificial Intelligence, Shanghai Jiao Tong University
2INTSIG
[paper|code]

Inharmonious Region

Here are some examples of inharmonious images (top row) and their inharmonious region masks (bottom row). These inharmonious region could be infered by comparing the color or illuminance with surrounding area.

Some examples of inharmonious region

DIRL Network

We also demonstrate our proposed DIRL(Deep Inharmonious Region Localization) network on the left part of following figure. The right part elaborates our proposed Bi-directional Feature Integration (BFI) block, Mask-guided Dual Attention (MDA) block, and Global-context Guided Decoder (GGD) block.

Some examples of inharmonious region

Quick Start

Install

Data Preparation

In this paper, we conduct all of the experiments on the latest released harmonization dataset iHarmoney4.

One concern is that the inharmonious region in an inharmonious image may be ambiguous because the background can also be treated as inharmonious region. To avoid the ambiguity, we only use the inharmonious images without using paired harmonious images, and simply discard the images with foreground occupying larger than 50% area, which only account for about 2% of the whole dataset.

We tailor the training set to 64255 images and test set to 7237 images respectively, yielding le50_train.txt and le50_test.text files in this project. And you can further divide the training list into training set and validation set, in which we randomly choose 10% items in le50_train.txt as validation set.

If you want to use other datasets, please follow the dataset loader file:data/ihd_dataset.py

Train and Test

Please specify the bash file. We provide a training and a test bash examples:train.sh, test.sh

One quick training command:

python3  dirl_train.py --dataset_root <PATH_TO_DATASET> --checkpoints_dir <PATH_TO_SAVE> --batch_size 8 --gpu_ids 0

Pretrained Model

Google Drive | Baidu Cloud (access code: hvto)

Download the model and put it to directory <save_dir>, where <save_dir> should be same as the bash parameter <checkpoints_dir>.

Visualization Results

Here we show show qualitative comparision with state-of-art methods of other related fields:

Some examples of inharmonious region

Besides, we visualize the refined feature from our proposed Mask-guided Dual Attention(MDA) block and compare it with vanilla Dual Attention(DA) block:

Some examples of inharmonious region

Citation

If you find this work or code is helpful in your research, please cite:

@inproceedings{Liang2021InharmoniousRL,
  title={Inharmonious Region Localization},
  author={Jing Liang and Li Niu and Liqing Zhang},
  booktitle={ICME},
  year={2021}
}

Reference

[1] Inharmonious Region Localization. Jing Liang, Li Niu, Liqing Zhang. Accepted by ICME. download

dirl-inharmonious-region-localization's People

Contributors

jimleungjing avatar ustcnewly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

bpsoda

dirl-inharmonious-region-localization's Issues

关于图像尺寸的问题

在运行程序的过程中,我发现评估是采用把图像尺寸规定到224*224来计算评估分数的,请问为什么不将图像还原到原本图像的大小来计算呢?如果说网络的输入输出不是224,而是其他的话,这样的评估是不是可能会产生一定的误差影响?

Evaluation results for each dataset

May I ask where can I find the results on four sub-datasets in Supplementary in the Inharmonious Region Localization by Magnifying Domain Discrepancy article on AAAI?

Unable to change backbone when training

Hello @jimleungjing,

Thanks for providing the implementation. I'm trying to re-train DIRL network by changing the backbone from Resnet34 to Resnet50 but it didn't work. Could you please comment on this on how to change the backbone. It seems we have to make some changes in the code in order for it to work?

image

Thanks

Add Object detection head to Encoder-Decoder

Hello,

Thanks for providing the implementation. Your work is very interesting. I'm interested to re-train this network to add object detection head at the end of this network in order to predict (mask, bounding box and class label) in the single network from tampered images. Can you please point where should I begin from? I want to use existing resnet features for detection + classification.

Any advice would be appreciated.
Thanks.

Accuracy drops on different system (CPU and on GPU both)

Hi,

Thanks for wonderful work and implementation. I've a question about the model behavior. I trained the model on cloud using a good GPU. The f1 score is good (0.7) which is acceptable for me. When I try to run the trained weights (encoder and decoder) on different System (CPU only and GPU only too). The performance drops significantly and the model is not giving same segmentation results as compared to the system where it was trained. Can you comment on this issue, why the performance decreasing on different system???

Thanks!
Shan

Why using Gaussian Filter in MDA ?

Very interesting work, some doubts as shown in the title.

It also makes me wonder that you said "the ground-truth mask M is resized to match the resolution of each A_{k}" in your paper, but I found that the code seemed to do the opposite.

Looking forward to your reply!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.