Skip to content

shao-chi/Image-Caption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Captioning

Getting Started

Prerequisites

  • Bulid docker
    Run bash docker_run.sh

  • Get Evaluation Function

    cd core/
    git clone https://github.com/tylin/coco-caption.git
    
    # Only use 'pycocoevalcap' directory
    mv pycocoevalcap/ metrics/
    
  • Get YOLOv5 Model

    cd data/
    git clone https://github.com/ultralytics/yolov5.git
    
  • Run Stanford NLP Server for tokenizing

    # Download CoreNLP https://stanfordnlp.github.io/CoreNLP/
    
    java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer \
        -preload tokenize,ssplit,pos,lemma,ner,parse,depparse \
        -status_port 9000 -port 9000 -timeout 15000 & 
    

Preprocess

  • Transform images and annotations into specific format
  • Split data into training set, validation set, and testing set
    python3 features.py
    

Train Model

  • Train the Transformer model (Caption Generator)
    python3 main.py train
    
    Save model while each epoch was end.

Evaluation

  • Evaluation the dataset
  • print the evaluation scores
    python3 main.py evaluation \
                    --split='test' \
                    --epoch=100 \
                    --beam-size=1
    
    epoch : which model
    split : which dataset splited when preprocessing
    beam-size : beam Search

Demo

  • Generate caption for one image
    python3 main.py demo \
                    --image-path={IMAGE_PATH} \
                    --epoch=100 \
                    --beam-size=1
    

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages