OpenCVのGrabCut()を利用したセマンティックセグメンテーション向けアノテーションツール(Annotation tool using GrabCut() of OpenCV. It can be used to create datasets for semantic segmentation.)

Overview

[Japanese/English]

GrabCut-Annotation-Tool

GrabCut-Annotation-Tool.mp4

OpenCVのGrabCut()を利用したアノテーションツールです。
セマンティックセグメンテーション向けのデータセット作成にご使用いただけます。
※GrabCutのアルゴリズムの都合上、境界がはっきりしているデータのアノテーションに向いています。

Requirement

  • opencv-python 4.5.2.54 or later
  • Pillow 7.2.0 or later
  • PySimpleGUI 4.32.1 or later

Directory

│  app.py
│  config.json
│  
├─core
│  │  gui.py
│  └─util.py
│          
├─input
│      
└─output
    ├─image
    └─annotation

app.py, core/gui.py, core/util.py

ソースコードです。

input

アノテーション対象の画像ファイルを格納するディレクトリです。

output

アノテーション結果を保存するディレクトリです。

  • image:リサイズした画像が格納されます
  • annotation:アノテーション結果が格納されます
    ※パレットモードのPNG形式で保存

Usage

次のコマンドで起動してください。

python app.py

起動時には以下オプションが指定可能です。

  • --input
    入力画像格納パス
    デフォルト:input
  • --output_image
    アノテーション結果(画像)の格納パス
    デフォルト:output/image
  • --output_annotation
    アノテーション結果(セグメンテーション画像)の格納パス
    デフォルト:output/annotation
  • --config
    ロードするコンフィグファイル
    デフォルト:config.json

Using GrabCut-Annotation-Tool

ファイル選択

ファイル一覧をクリックすることでアノテーション対象を切り替えることが出来ます。
ショートカットキー ↑、p:上のファイルへ ↓、n:下のファイルへ

初期ROI指定

「Select ROI」と表示されている時にマウス右ドラッグで初期ROIを指定できます。


ドラッグ終了後、GrabCut処理が行われます。


領域が選択されます。


後景指定

マウス右ドラッグで後景の指定が出来ます。




前景指定

「Manually label background」のチェックを外すことで前景指定に切り替えることが出来ます
ショートカットキー Ctrl


マウス右ドラッグで前景の指定が出来ます。




クラスID切り替え

Class IDのチェックボックスを押すことでクラスIDを切り替えることが出来ます。
一桁のIDはショートカットキーでの切り替えも可能です。
ショートカットキー 0-9


クラスID切り替え後はROI指定を行う必要があります。




自動保存

リサイズ画像とアノテーション画像はGrabCut処理毎に自動保存されます。


自動保存をしたくない場合は「Auto save」のチェックを外してください。
自動保存以外で保存したい場合は、キーボード「s」を押してください。


その他設定


  • Mask alpha:画像のマスク重畳表示の濃淡具合
  • Iteration:GrabCutアルゴリズムのイテレーション回数
  • Draw thickness:前景/後景指定時の線の太さ
  • Output width:出力画像の横幅
  • Output height:出力画像の縦幅

ToDo

  • メモリリーク対策
  • ROI選択時に左上→右下ドラッグ以外も可能にする
  • クラスIDをショートカットキーで選択した際にROI選択表示にする

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

GrabCut-Annotation-Tool is under Apache-2.0 License.

サンプル画像はフリー素材ぱくたそ様の写真を利用しています。

You might also like...
IJON is an annotation mechanism that analysts can use to guide fuzzers such as AFL.
IJON is an annotation mechanism that analysts can use to guide fuzzers such as AFL.

IJON SPACE EXPLORER IJON is an annotation mechanism that analysts can use to guide fuzzers such as AFL. Using only a small (usually one line) annotati

Mae segmentation - Reproduction of semantic segmentation using masked autoencoder (mae)

ADE20k Semantic segmentation with MAE Getting started Install the mmsegmentation

Object detection using yolo-tiny model and opencv used as backend
Object detection using yolo-tiny model and opencv used as backend

Object detection Algorithm used : Yolo algorithm Backend : opencv Library required: opencv = 4.5.4-dev' Quick Overview about structure 1) main.py Load

Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation, CVPR 2018
Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation, CVPR 2018

Learning Pixel-level Semantic Affinity with Image-level Supervision This code is deprecated. Please see https://github.com/jiwoon-ahn/irn instead. Int

A embed able annotation tool for end to end cross document co-reference
A embed able annotation tool for end to end cross document co-reference

CoRefi CoRefi is an emebedable web component and stand alone suite for exaughstive Within Document and Cross Document Coreference Anntoation. For a de

A graphical Semi-automatic annotation tool based on labelImg and Yolov5
A graphical Semi-automatic annotation tool based on labelImg and Yolov5

💕YOLOV5 semi-automatic annotation tool (Based on labelImg)

Open source annotation tool for machine learning practitioners.
Open source annotation tool for machine learning practitioners.

doccano doccano is an open source text annotation tool for humans. It provides annotation features for text classification, sequence labeling and sequ

ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system
ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system

ObjectDrawer-ToolBox is a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system, Object Drawer.

performing moving objects segmentation using image processing techniques with opencv and numpy
performing moving objects segmentation using image processing techniques with opencv and numpy

Moving Objects Segmentation On this project I tried to perform moving objects segmentation using background subtraction technique. the introduced meth

Comments
  • Memory leak in PySimpleGUI Graph.

    Memory leak in PySimpleGUI Graph.

    core/gui.py

    You need to clear the canvas before using draw_image(). Otherwise, canvases will continue to be added and memory leaks will occur.

            self._window['-IMAGE ORIGINAL-'].draw_image(
                data=bytes_image,
                location=(0, imaga_height),
            )
    

    You need to call delete_figure() as follows:

            if self._graph_image_id is not None:
                self._window['-IMAGE ORIGINAL-'].delete_figure(self._graph_image_id)
    
            self._graph_image_id = self._window['-IMAGE ORIGINAL-'].draw_image(
                data=bytes_image,
                location=(0, imaga_height),
            )
    
    opened by Kazuhito00 1
  • WOW!  What an amazing program!

    WOW! What an amazing program!

    I stumbled onto your project the other day and had to look, multiple times, to see that it is a PySimpleGUI-based program. Very nicely done! Thanks for the great screenshots in your readme. I'm sure visitors are enjoying the show as much as I have.

    opened by PySimpleGUI 1
Releases(v0.1.3)
Owner
KazuhitoTakahashi
KazuhitoTakahashi
[CVPR 2021] NormalFusion: Real-Time Acquisition of Surface Normals for High-Resolution RGB-D Scanning

NormalFusion: Real-Time Acquisition of Surface Normals for High-Resolution RGB-D Scanning Project Page | Paper | Supplemental material #1 | Supplement

KAIST VCLAB 49 Nov 24, 2022
Cerberus Transformer: Joint Semantic, Affordance and Attribute Parsing

Cerberus Transformer: Joint Semantic, Affordance and Attribute Parsing Paper Introduction Multi-task indoor scene understanding is widely considered a

62 Dec 05, 2022
Pipeline code for Sequential-GAM(Genome Architecture Mapping).

Sequential-GAM Pipeline code for Sequential-GAM(Genome Architecture Mapping). mapping whole_preprocess.sh include the whole processing of mapping. usa

3 Nov 03, 2022
Code for "Sparse Steerable Convolutions: An Efficient Learning of SE(3)-Equivariant Features for Estimation and Tracking of Object Poses in 3D Space"

Sparse Steerable Convolution (SS-Conv) Code for "Sparse Steerable Convolutions: An Efficient Learning of SE(3)-Equivariant Features for Estimation and

25 Dec 21, 2022
Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)

Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021) Jiaxi Jiang, Kai Zhang, Radu Timofte Computer Vision Lab, ETH Zurich, Switzerland 🔥

Jiaxi Jiang 282 Jan 02, 2023
KwaiRec: A Fully-observed Dataset for Recommender Systems (Density: Almost 100%)

KuaiRec: A Fully-observed Dataset for Recommender Systems (Density: Almost 100%) KuaiRec is a real-world dataset collected from the recommendation log

Chongming GAO (高崇铭) 70 Dec 28, 2022
Official pytorch implementation of the IrwGAN for unaligned image-to-image translation

IrwGAN (ICCV2021) Unaligned Image-to-Image Translation by Learning to Reweight [Update] 12/15/2021 All dataset are released, trained models and genera

37 Nov 09, 2022
MultiLexNorm 2021 competition system from ÚFAL

ÚFAL at MultiLexNorm 2021: Improving Multilingual Lexical Normalization by Fine-tuning ByT5 David Samuel & Milan Straka Charles University Faculty of

ÚFAL 13 Jun 28, 2022
PyTorch implementation of Higher Order Recurrent Space-Time Transformer

Higher Order Recurrent Space-Time Transformer (HORST) This is the official PyTorch implementation of Higher Order Recurrent Space-Time Transformer. Th

13 Oct 18, 2022
Official PyTorch Implementation of "Self-supervised Auxiliary Learning with Meta-paths for Heterogeneous Graphs". NeurIPS 2020.

Self-supervised Auxiliary Learning with Meta-paths for Heterogeneous Graphs This repository is the implementation of SELAR. Dasol Hwang* , Jinyoung Pa

MLV Lab (Machine Learning and Vision Lab at Korea University) 48 Nov 09, 2022
Code for the paper "Graph Attention Tracking". (CVPR2021)

SiamGAT 1. Environment setup This code has been tested on Ubuntu 16.04, Python 3.5, Pytorch 1.2.0, CUDA 9.0. Please install related libraries before r

122 Dec 24, 2022
Image transformations designed for Scene Text Recognition (STR) data augmentation. Published at ICCV 2021 Workshop on Interactive Labeling and Data Augmentation for Vision.

Data Augmentation for Scene Text Recognition (ICCV 2021 Workshop) (Pronounced as "strog") Paper Arxiv Why it matters? Scene Text Recognition (STR) req

Rowel Atienza 152 Dec 28, 2022
PyTorch wrappers for using your model in audacity!

audacitorch This package contains utilities for prepping PyTorch audio models for use in Audacity. More specifically, it provides abstract classes for

Hugo Flores García 130 Dec 14, 2022
Code for KDD'20 "An Efficient Neighborhood-based Interaction Model for Recommendation on Heterogeneous Graph"

Heterogeneous INteract and aggreGatE (GraphHINGE) This is a pytorch implementation of GraphHINGE model. This is the experiment code in the following w

Jinjiarui 69 Nov 24, 2022
Simple image captioning model - CLIP prefix captioning.

Simple image captioning model - CLIP prefix captioning.

688 Jan 04, 2023
Adaout is a practical and flexible regularization method with high generalization and interpretability

Adaout Adaout is a practical and flexible regularization method with high generalization and interpretability. Requirements python 3.6 (Anaconda versi

lambett 1 Feb 09, 2022
ConvMAE: Masked Convolution Meets Masked Autoencoders

ConvMAE ConvMAE: Masked Convolution Meets Masked Autoencoders Peng Gao1, Teli Ma1, Hongsheng Li2, Jifeng Dai3, Yu Qiao1, 1 Shanghai AI Laboratory, 2 M

Alpha VL Team of Shanghai AI Lab 345 Jan 08, 2023
This repository contains the implementation of the following paper: Cross-Descriptor Visual Localization and Mapping

Cross-Descriptor Visual Localization and Mapping This repository contains the implementation of the following paper: "Cross-Descriptor Visual Localiza

Mihai Dusmanu 81 Oct 06, 2022
ML-Decoder: Scalable and Versatile Classification Head

ML-Decoder: Scalable and Versatile Classification Head Paper Official PyTorch Implementation Tal Ridnik, Gilad Sharir, Avi Ben-Cohen, Emanuel Ben-Baru

189 Jan 04, 2023
End-to-end image segmentation kit based on PaddlePaddle.

English | 简体中文 PaddleSeg PaddleSeg has released the new version including the following features: Our team won the 6.2k Jan 02, 2023