All Projects → li-xirong → hierse

li-xirong / hierse

Licence: MIT License
Zero-shot image tagging by hierarchical semantic embedding

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
shell
77523 projects
c
50402 projects - #5 most used programming language
Makefile
30231 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to hierse

Awesome-Zero-Shot-Object-Detection
No description or website provided.
Stars: ✭ 89 (+15.58%)
Mutual labels:  zero-shot-learning
aws-rekognition
A Laravel Package/Facade for the AWS Rekognition API
Stars: ✭ 20 (-74.03%)
Mutual labels:  image-recognition
Symbol
Symbol .net library
Stars: ✭ 14 (-81.82%)
Mutual labels:  image-recognition
Sign-Language-App
Training a model to recognize Sign Language then running inference on the Webcam
Stars: ✭ 25 (-67.53%)
Mutual labels:  image-recognition
GFNet
[NeurIPS 2021] Global Filter Networks for Image Classification
Stars: ✭ 199 (+158.44%)
Mutual labels:  image-recognition
Contactless-Attendance-System
✨ A Contactless Attendance System where your face is identified for Attendance.
Stars: ✭ 20 (-74.03%)
Mutual labels:  image-recognition
neuron-importance-zsl
[ECCV 2018] code for Choose Your Neuron: Incorporating Domain Knowledge Through Neuron Importance
Stars: ✭ 56 (-27.27%)
Mutual labels:  zero-shot-learning
Deep-Learning
It contains the coursework and the practice I have done while learning Deep Learning.🚀 👨‍💻💥 🚩🌈
Stars: ✭ 21 (-72.73%)
Mutual labels:  image-recognition
lookup
🔍 Pure Go implementation of fast image search and simple OCR, focused on reading info from screenshots
Stars: ✭ 35 (-54.55%)
Mutual labels:  image-recognition
Reproducibilty-Challenge-ECANET
Unofficial Implementation of ECANets (CVPR 2020) for the Reproducibility Challenge 2020.
Stars: ✭ 27 (-64.94%)
Mutual labels:  image-recognition
taggr
⚡️ Rediscover your memories while keeping your privacy.
Stars: ✭ 20 (-74.03%)
Mutual labels:  image-recognition
Image-Detection-Samples
This sample app supports "Building a MVP with Face recognition and AR" and "Quest of a Hero part 2" presentations as well as it has two different possibilities to build face detection mechanism. The first one is OpenCV based and the second one is by means of Camera 2 API
Stars: ✭ 36 (-53.25%)
Mutual labels:  image-recognition
TriangleGAN
TriangleGAN, ACM MM 2019.
Stars: ✭ 28 (-63.64%)
Mutual labels:  image-recognition
auto-tagging-image-search
A back-end service that tags images automatically using Google-Vision and translate tags so you can search these images by tags in two languages.
Stars: ✭ 17 (-77.92%)
Mutual labels:  image-recognition
PlayerDetection
Player detection and ball detection in football matches using image processing(opencv).
Stars: ✭ 50 (-35.06%)
Mutual labels:  image-recognition
robotframework-imagehorizonlibrary
Cross-platform Robot Framework library for GUI automation based on image recognition
Stars: ✭ 67 (-12.99%)
Mutual labels:  image-recognition
domain-adaptation-capls
Unsupervised Domain Adaptation via Structured Prediction Based Selective Pseudo-Labeling
Stars: ✭ 43 (-44.16%)
Mutual labels:  zero-shot-learning
object-flaw-detector-python
Detect various irregularities of a product as it moves along a conveyor belt.
Stars: ✭ 17 (-77.92%)
Mutual labels:  image-recognition
face-attendence
Face Attendance (AWS rekognition)
Stars: ✭ 39 (-49.35%)
Mutual labels:  image-recognition
al-fk-self-supervision
Official PyTorch code for CVPR 2020 paper "Deep Active Learning for Biased Datasets via Fisher Kernel Self-Supervision"
Stars: ✭ 28 (-63.64%)
Mutual labels:  image-recognition

HierSE

Given the difficulty of acquiring labeled examples for many fine-grained visual classes, there is an increasing interest in zero-shot image tagging, aiming to tag images with novel labels that have no training examples present. This project provides pure python (and thus cross-platform) implementation of two semantic embedding based methods for zero-shot image tagging, namely Convex Semantic Embedding (ConSE) [1] and Hierarchical Semantic Embedding (HierSE) [2].

Zero-shot image tagging by hierarchical semantic embedding

The key idea of zero shot learning is to introduce an intermediate layer between images and labels such that a novel label can also be represented in this layer, even when no example of this label is supplied. In ConSE and HierSE, this layer is implemented using a word2vec semantic space.

Why Hierarchical Semantic Embedding?

  1. Make the label embedding more reliable, in particular for those of relatively low occurrence
  2. Resolve semantic ambiguity by embedding a label into distinct vectors, depending on its given sense. This is a more fundamental advantage compared to ConSE or other semantic embedding methods where a specific tag will always be represented by the same vector, regardless of its senses. Imagine a label of multiple senses, e.g., mouse, which can be rat or computer mouse.

Dependencies

  1. numpy
  2. pre-trained word2vec model: learned from social tags of over 4 million Flickr images (flickr4m) using Word2Vec. The pre-trained model is also available at google drive. The original flickr4m tags can be downloaded here.

Getting started

git clone https://github.com/li-xirong/hierse
cd hierse/doit
./get_word2vec_model.sh 
cd ..
python test_all.py

Run test_all.py to see if everything is in place. For hands-on examples, please refer to scripts in the doit folder and the tutorial page.

Implementation

The process of projecting a novel label to the w2v layer is described in the Synset2Vec class, PartialSynset2Vec class in synset2vec.py, and the HierSynset2Vec class, the HierPartialSynset2Vec class in synset2vec_hier.py, respectively. The four classes corresponds to four different methods (conse, conse2, hierse, hierse2) for vectorizing a WordNet synset, determined by the choice of phrase matching strategies (full match or partial match) and whether the WordNet hierarchy is considered.

  1. conse: full match + no hierarchy
  2. conse2: partial match + no hierarchy
  3. hierse: full match + hierarchy
  4. hierse2: partial match + hierarchy

The Image2Vec class in im2vec.py projects an (unlabeled) image to this layer. The training label set is ImageNet ilsvrc12_test1k. Our code assumes that probabilistic relevance score of each training label with respect to the image has been pre-computed and stored. see the provided sample set imagenet2hop-random2k. That said, as long as you have a pre-trained (CNN) model, e.g., caffenet or tensorflow series, that can predict the 1k ILSVRC12 labels, the code also works, see the tutorial page.

Having both image and label vectorized, the ZeroshotTagger class in tagger.py predicts the most likely labels.

Using your own data (images and labels)

The current version demonstrates the use of ConSE and HierSE on imagenet2hop-random2k, a subset of 2k images randomly selected from the whole test set of 1.3 million images. Most of the code is self-explained, I hope ;). Nevertheless, a bit coding is probably needed to make the code run on new data, in particular for a new training label set (Y0) and a new test label set (Y1) other than ilsvrc12_test1k and ilsvrc12_test1k_2hop.

To perform zero-shot tagging on a test image set X:

  1. Use an existing classification system to generate probabilistic relevance score of each label in Y0 w.r.t each image in X. Using txt2bin.py to store the predictions in the required binary format.
  2. Modify and run do_label2vec.sh to vectorize Y0 and Y1.
  3. Do image tagging by calling zero_shot_tagging.py.
  4. Report hit@1, hit@2, hit@5, hit@10 using evaluate.py

References

  1. Mohammad Norouzi, Tomas Mikolov, Samy Bengio, Yoram Singer, Jonathon Shlens, Andrea Frome, Greg Corrado, Jeffrey Dean, Zero-shot learning by convex combination of semantic embedding, ICLR, 2014
  2. Xirong Li, Shuai Liao, Weiyu Lan, Xiaoyong Du, Gang Yang, Zero-shot image tagging by hierarchical semantic embedding, SIGIR, 2015
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].