mrdvince / image_captioning

Automatically produce captions given an input image, using a resnet 50 as the encoder and a custom defined Decoder RNN, basically by combining a CNN for feature extraction and an RNN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Captioning

Configure and Manage Your Environment with Anaconda

Per the Anaconda docs:

Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.

Overview

Using Anaconda consists of the following:

  1. Install miniconda on your computer, by selecting the latest Python version for your operating system. If you already have conda or miniconda installed, you should be able to skip this step and move on to step 2.
  2. Create and activate * a new conda environment.

* Each time you wish to work on any exercises, activate your conda environment!


1. Installation

Download the latest version of miniconda that matches your system.

NOTE: There have been reports of issues creating an environment using miniconda v4.3.13. If it gives you issues try versions 4.3.11 or 4.2.12 from here.

Linux Mac Windows
64-bit 64-bit (bash installer) 64-bit (bash installer) 64-bit (exe installer)
32-bit 32-bit (bash installer) 32-bit (exe installer)

Install miniconda on your machine. Detailed instructions:

2. Create and Activate the Environment

For Windows users, these following commands need to be executed from the Anaconda prompt as opposed to a Windows terminal window. For Mac, a normal terminal window will work.

Git and version control

These instructions also assume you have git installed for working with Github from a terminal window, but if you do not, you can download that first with the command:

conda install git

Create our local environment!

  1. Clone the repository, and navigate to the downloaded folder. This may take a minute or two to clone due to the included image data.
https://github.com/mrdvince/image_captioning
cd image_captioning
  1. Create (and activate) a new environment, named imgcap with Python 3.6. If prompted to proceed with the install (Proceed [y]/n) type y.

    • Linux or Mac:
    conda create -n imgcap python=3.6
    source activate imgcap
    
    • Windows:
    conda create --name imgcap python=3.6
    activate imgcap
    

    At this point your command line should look something like: (imgcap) <User>:image-captioning <user>$. The (imgcap) indicates that your environment has been activated, and you can proceed with further package installations.

  2. Install PyTorch and torchvision; this should install the latest version of PyTorch.

    • Linux or Mac:
    conda install pytorch torchvision -c pytorch 
    
    • Windows:
    conda install pytorch-cpu -c pytorch
    pip install torchvision
    
  3. Install a few required pip packages, which are specified in the requirements text file (including OpenCV).

pip install -r requirements.txt
  1. That's it!

Now all of the imgcap libraries are available

cd
cd image_captioning
python train.py -c config.json

Notes on environment creation and deletion

Verify that the imgcap environment was created in your environments:

conda info --envs

Cleanup downloaded libraries (remove tarballs, zip files, etc):

conda clean -tp

Uninstall the environment (if you want); you can remove it by name:

conda env remove -n imgcap

About

Automatically produce captions given an input image, using a resnet 50 as the encoder and a custom defined Decoder RNN, basically by combining a CNN for feature extraction and an RNN


Languages

Language:Jupyter Notebook 76.8%Language:Python 23.2%