LoginSignup
0
0

More than 1 year has passed since last update.

[備忘録] アノテーションツール labelImgの環境構築

Posted at

メニュー


はじめに

  • 教師あり学習では、画像データにラベルを付与することで、初めて意味のある学習データになります。
  • 本マニュアルでは、ラベリングツールlabelImg (Pythonのプログラム)によるラベリング手順を紹介します。

Pythonの環境構築

pyenvの導入 (shellがzshの場合)

  • pyenvはPythonの複数のバージョンを簡単に切り替えることができます。
  1. GitHubのリポジトリをクローン (https://github.com/pyenv/pyenv
    $ git clone https://github.com/pyenv/pyenv
    
  2. ~/.zprofile~/.profile~/.zshrcに下記のテキストを追記する
    ~/.zprofile
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init --path)"
    
    ~/.profile
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init --path)"
    
    ~/.zshrc
    eval "$(pyenv init -)"
    

仮想環境の作成

  1. 適当なディレクトリを作成

    $ mkdir dataset
    $ cd dataset
    
  2. 使いたいPythonのバージョンをインストールする

    • インストールできるPythonのバージョンを確認
      $ pyenv install --list
      
    • バージョン3.8.5をインストールするとする
      • Pythonは2系3系があります。今回は3系を使います。
      $ pyenv install 3.8.5
      
    • 先ほど作成したディレクトリに反映(.python-versionというファイルが作成される)
      $ pyenv local 3.8.5 
      
  3. venvによる仮想環境の作成

    • パッケージをプロジェクトごとに独立させることができます。(Python3の標準機能なので別途インストールは不要)
    • 新しい環境の作成
      • newenvnameは好きな名前でいいです。(venv.venvが一般的)
      • newenvname下にパッケージが置かれます。
    $ python -m venv [newenvname]
    
    • 有効化
    $ source [newenvname]/bin/activate
    
    • 無効化
    $ deactivate
    

labelImgの導入

  1. レポジトリのクローン (https://github.com/tzutalin/labelImg

    $ git clone https://github.com/tzutalin/labelImg
    $ cd labelImg
    
  2. pipでパッケージのインストール

    $ pip install -r requirements/requirements-linux-python3.txt
    $ make qt5py3
    
  3. labelImgの起動

    $ python labelImg.py [画像ファイルのパス] [分類クラスのテキストファイル]
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0