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
Pre-trained models for a Cascaded-FCN in caffe and tensorflow that segments

Cascaded-FCN This repository contains the pre-trained models for a Cascaded-FCN in caffe and tensorflow that segments the liver and its lesions out of

300 Nov 22, 2022
An Unsupervised Graph-based Toolbox for Fraud Detection

An Unsupervised Graph-based Toolbox for Fraud Detection Introduction: UGFraud is an unsupervised graph-based fraud detection toolbox that integrates s

SafeGraph 99 Dec 11, 2022
This repository is the offical Pytorch implementation of ContextPose: Context Modeling in 3D Human Pose Estimation: A Unified Perspective (CVPR 2021).

Context Modeling in 3D Human Pose Estimation: A Unified Perspective (CVPR 2021) Introduction This repository is the offical Pytorch implementation of

37 Nov 21, 2022
PURE: End-to-End Relation Extraction

PURE: End-to-End Relation Extraction This repository contains (PyTorch) code and pre-trained models for PURE (the Princeton University Relation Extrac

Princeton Natural Language Processing 657 Jan 09, 2023
Implementation of "Fast and Flexible Temporal Point Processes with Triangular Maps" (Oral @ NeurIPS 2020)

Fast and Flexible Temporal Point Processes with Triangular Maps This repository includes a reference implementation of the algorithms described in "Fa

Oleksandr Shchur 20 Dec 02, 2022
using STGCN to achieve egg classification task

EEG Classification   The task requires us to classify electroencephalography(EEG) into six categories, including human body, human face, animal body,

4 Jun 13, 2022
Compositional and Parameter-Efficient Representations for Large Knowledge Graphs

NodePiece - Compositional and Parameter-Efficient Representations for Large Knowledge Graphs NodePiece is a "tokenizer" for reducing entity vocabulary

Michael Galkin 107 Jan 04, 2023
Pytorch implementation of SenFormer: Efficient Self-Ensemble Framework for Semantic Segmentation

SenFormer: Efficient Self-Ensemble Framework for Semantic Segmentation Efficient Self-Ensemble Framework for Semantic Segmentation by Walid Bousselham

61 Dec 26, 2022
Colab notebook and additional materials for Python-driven analysis of redlining data in Philadelphia

RedliningExploration The Google Colaboratory file contained in this repository contains work inspired by a project on educational inequality in the Ph

Benjamin Warren 1 Jan 20, 2022
HCQ: Hybrid Contrastive Quantization for Efficient Cross-View Video Retrieval

HCQ: Hybrid Contrastive Quantization for Efficient Cross-View Video Retrieval [toc] 1. Introduction This repository provides the code for our paper at

13 Dec 08, 2022
This is the code related to "Sparse-to-dense Feature Matching: Intra and Inter domain Cross-modal Learning in Domain Adaptation for 3D Semantic Segmentation" (ICCV 2021).

Sparse-to-dense Feature Matching: Intra and Inter domain Cross-modal Learning in Domain Adaptation for 3D Semantic Segmentation This is the code relat

39 Sep 23, 2022
[CVPR-2021] UnrealPerson: An adaptive pipeline for costless person re-identification

UnrealPerson: An Adaptive Pipeline for Costless Person Re-identification In our paper (arxiv), we propose a novel pipeline, UnrealPerson, that decreas

ZhangTianyu 70 Oct 10, 2022
Individual Tree Crown classification on WorldView-2 Images using Autoencoder -- Group 9 Weak learners - Final Project (Machine Learning 2020 Course)

Created by Olga Sutyrina, Sarah Elemili, Abduragim Shtanchaev and Artur Bille Individual Tree Crown classification on WorldView-2 Images using Autoenc

2 Dec 08, 2022
🥈78th place in Riiid Solution🥈

Riiid Answer Correctness Prediction Introduction This repository is the code that placed 78th in Riiid Answer Correctness Prediction competition. Requ

ds wook 14 Apr 26, 2022
STMTrack: Template-free Visual Tracking with Space-time Memory Networks

STMTrack This is the official implementation of the paper: STMTrack: Template-free Visual Tracking with Space-time Memory Networks. Setup Prepare Anac

Zhihong Fu 62 Dec 21, 2022
Reproduce results and replicate training fo T0 (Multitask Prompted Training Enables Zero-Shot Task Generalization)

T-Zero This repository serves primarily as codebase and instructions for training, evaluation and inference of T0. T0 is the model developed in Multit

BigScience Workshop 253 Dec 27, 2022
Semi-Supervised Signed Clustering Graph Neural Network (and Implementation of Some Spectral Methods)

SSSNET SSSNET: Semi-Supervised Signed Network Clustering For details, please read our paper. Environment Setup Overview The project has been tested on

Yixuan He 9 Nov 24, 2022
This repo contains source code and materials for the TEmporally COherent GAN SIGGRAPH project.

TecoGAN This repository contains source code and materials for the TecoGAN project, i.e. code for a TEmporally COherent GAN for video super-resolution

Nils Thuerey 5.2k Jan 02, 2023
The code of NeurIPS 2021 paper "Scalable Rule-Based Representation Learning for Interpretable Classification".

Rule-based Representation Learner This is a PyTorch implementation of Rule-based Representation Learner (RRL) as described in NeurIPS 2021 paper: Scal

Zhuo Wang 53 Dec 17, 2022
Animal Sound Classification (Cats Vrs Dogs Audio Sentiment Classification)

this is a simple artificial neural network model using deep learning and torch-audio to classify cats and dog sounds.

crispengari 3 Dec 05, 2022