Awesome
One-shot Affordance Detection
PyTorch implementation of our one-shot affordance detection models. This repository contains PyTorch evaluation code, training code and pretrained models.
π Table of content
- π Paper Link
- π‘ Abstract
- π Method
- π Dataset
- π Requirements
- βοΈ Usage
- π Experimental Results
- π Potential Applications
- βοΈ Statement
- β¨ Other Relevant Works
- π Citation
π Paper Link <a name="1"></a>
- One-Shot Affordance Detection (IJCAI2021) (link)
Authors: Hongchen Luo, Wei Zhai, Jing Zhang, Yang Cao, Dacheng Tao
- One-Shot Affordance Detection in the Wild (IJCV) (link)
Authors: Wei Zhai*, Hongchen Luo*, Jing Zhang, Yang Cao, Dacheng Tao
π‘ Abstract <a name="2"></a>
Affordance detection refers to identifying the potential action possibilities of objects in an image, which is a crucial ability for robot perception and manipulation. To empower robots with this ability in unseen scenarios, we first consider the challenging one-shot affordance detection problem in this paper, i.e., given a support image that depicts the action purpose, all objects in a scene with the common affordance should be detected. To this end, we devise a One-Shot Affordance Detection Network (OSAD-Net) that firstly estimates the human action purpose and then transfers it to help detect the common affordance from all candidate images. Through collaboration learning, OSAD-Net can capture the common characteristics between objects having the same underlying affordance and learn a good adaptation capability for perceiving unseen affordances. Besides, we build a Purpose-driven Affordance Dataset v2 (PADv2) by collecting and labeling 30k images from 39 affordance and 103 object categories. With complex scenes and rich annotations, our PADv2 can comprehensively understand the affordance of objects and can even be used in other vision tasks, such as scene understanding, action recognition, robot manipulation, etc. We present a standard one-shot affordance detection benchmark comparing 11 advanced models in several different fields. Experimental results demonstrate the superiority of our model over previous representative ones in terms of both objective metrics and visual quality.
<p align="center"> <img src="./img/fig1.png" width="500"/> <br /> <em> </em> </p>Illustration of perceiving affordance. Given a support image that depicts the action purpose, all objects in ascene with the common affordance could be detected.
π Method <a name="3"></a>
OSAD-Net (IJCAI2021) <a name="31"></a>
<p align="center"> <img src="./img/pipeline12.png" width="750"/> <br /> <em> </em> </p>Our One-Shot Affordance Detection (OS-AD) network. OSAD-Net_ijcai consists of three key modules: Purpose Learning Module (PLM), Purpose Transfer Module (PTM), and Collaboration Enhancement Module (CEM). (a) PLM aims to estimate action purpose from the human-object interaction in the support image. (b) PTM transfers the action purpose to the query images via an attention mechanism to enhance the relevant features. (c) CEM captures the intrinsic characteristics between objects having the common affordance to learn a better affordance perceiving ability.
OSAD-Net (Extended Version) <a name="32"></a>
<p align="center"> <img src="./img/pipeline2.png" width="700"/> <br /> <em> </em> </p>The framework of our OSAD-Net. For our OSAD-Net pipeline, the network first uses a Resnet50 to extract the features of support image and query images. Subsequently, the support feature, the bounding box of the person and object, and the pose of the person are fed together into the action purpose learning (APL) module to obtain the human action purpose features. And then send the human action purpose features and query images together to the mixture purpose transfer (MPT) to transfer the human action purpose to query images and activate the object region belonging to the affordance in the query images. Then, the output of the MPT is fed into a densely collaborative enhancement (DCE) module to learn the commonality among objects of the same affordance and suppress the irrelevant background regions using the cooperative strategy, and finally feed into the decoder to obtain the final detection results.
π Dataset <a name="4"></a>
<p align="center"> <img src="./img/dataset_example.png" width="750"/> <br /> <em> </em> </p>The samples images in the PADv2 of this paper. Our PADv2 has rich annotations such as affordance masks as well as depth information. Thus it provides a solid foundation for the affordance detection task.
<p align="center"> <img src="./img/dataset1.png" width="750"/> <br /> <em> </em> </p>The properties of PADv2. (a) The classification structure of the PADv2 in this paper consists of 39 affordance categories and 103 object categories. (b) The word cloud distribution of the PADv2. (c) Overlapping masks visualization of PADv2 mixed with specific affordance classes and overall category masks. (d) Confusion matrix of PADv2 affordance category and object category, where the horizontal axis corresponds to the object category and the vertical axis corresponds to the affordance category, (e) Distribution of co-occurring attributes of the PADv2, the grid is numbered for the total number of images.
π Requirements <a name="5"></a>
- python 3.7
- pytorch 1.1.0
- opencv
- scipy
- matplotlib
βοΈ Usage <a name="6"></a>
git clone https://github.com/lhc1224/OSAD_Net.git
cd OSAD-Net
Download PAD <a name="41"></a>
- You can download the PAD from [ Google Drive | Baidu Pan (z40m) ].
cd Downloads/
unzip PAD.zip
cd OSAD-Net
mkdir datasets/PAD
mv Downloads/PAD/divide_1 datasets/PAD/
mv Downloads/PAD/divide_2 datasets/PAD/
mv Downloads/PAD/divide_3 datasets/PAD/
Download PADv2 <a name="42"></a>
- You can download the PADv2 from [ Google Drive | Baidu Pan (1ttj) ].
cd Downloads/
unzip PADv2_part1.zip
cd OSAD-Net
mkdir datasets/PADv2_part1
mv Downloads/PADv2_part1/divide_1 datasets/PADv2_part1/
mv Downloads/PADv2_part1/divide_2 datasets/PADv2_part1/
mv Downloads/PADv2_part1/divide_3 datasets/PADv2_part1/
- The other part of the PADv2 dataset is available from [ Baidu Pan (r8a3) ].
Train <a name="61"></a>
You can download the pretrained model from [ Google Drive | Baidu Pan (xjk5) ], then move it to the models
folder
To train the OSAD-Net_ijcai model, run run_os_ad.py
with the desired model architecture:
python run_os_ad.py
To train the OSAD-Net model, run run_os_adv2.py
with the desired model architecture:
python run_os_adv2.py
Test <a name="62"></a>
To test the OSAD-Net_ijcai model, run run_os_ad.py
:
python run_os_ad.py --mode test
To test the OSAD-Net model, run run_os_ad.py
, you can download the trained models from [ Google Drive | Baidu Pan (611r) ]
python run_os_adv2.py --mode test
Evaluation <a name="63"></a>
In order to evaluate the forecast results, the evaluation code can be obtained via the following Evaluation Tools.
π Experimental Results <a name="7"></a>
Performance on PADv2 <a name="71"></a>
You can download the affordance maps from [ Google Drive | Baidu Pan (hwtf) ]
<p align="center"> <img src="./img/PADV2result2.png" width="800"/> <br /> <em> </em> </p>Performance on PAD <a name="72"></a>
You can download the affordance maps from [ Google Drive | Baidu Pan (hrlj) ]
<p align="center"> <img src="./img/PADresult.png" width="750"/> <br /> <em> </em> </p>π Potential Applications <a name="8"></a>
<p align="center"> <img src="./img/Potential_Applications.png" width="650"/> <br /> <em> </em> </p>Potential Applications of one-shot affordance system. (a) Application I: Content Image Retrieval. The content image retrieval model combined with affordance detection has a promising application in search engines and online shopping platforms. (b) Application II: Learning from Demonstration. The one-shot affordance detection model can help an agent to naturally select the correct object based on the expertβs actions. (c) Application III: Self-exploration of Agents. The one-shot affordance detection model helps an agent to autonomously perceive all instances or areas of a scene with the similar affordance property in unknown human spaces based on historical data (e.g., images of human interactions)
βοΈ Statement <a name="9"></a>
For any other questions please contact lhc12@mail.ustc.edu.cn or wzhai056@ustc.edu.cn.
β¨ Other Relevant Works <a name="10"></a>
1.The paper "Phrase-Based Affordance Detection via Cyclic Bilateral Interaction" was accepted by IEEE Transactions on Artificial Intelligence (T-AI). The papers and code can be downloaded from the [link].
2.The paper "Learning Affordance Grounding from Exocentric Images" is accepted by CVPR2022 and the corresponding paper and code are available from the [link].
3.The paper "Grounding 3D Object Affordance from 2D Interactions in Images" and the corresponding code are obtained from the [link].
π Citation <a name="11"></a>
@inproceedings{Oneluo,
title={One-Shot Affordance Detection},
author={Hongchen Luo and Wei Zhai and Jing Zhang and Yang Cao and Dacheng Tao},
booktitle={IJCAI},
year={2021}
}
@article{luo2021one,
title={One-Shot Object Affordance Detection in the Wild},
author={Zhai, Wei and Luo, Hongchen and Zhang, Jing and Cao, Yang and Tao, Dacheng},
journal={arXiv preprint arXiv:2108.03658},
year={2021}
}
@inproceedings{Lu2022Phrase,
title={Phrase-Based Affordance Detection via Cyclic Bilateral Interaction},
author={Liangsheng Lu and Wei Zhai and Hongchen Luo and Yang Cao},
year={2022}
}