All Projects → acl21 → Image_bbox_slicer

acl21 / Image_bbox_slicer

Licence: mit
This easy-to-use library splits images and its bounding box annotations into tiles, both into specific sizes and into any arbitrary number of equal parts. It can also resize them, both by specific sizes and by a resizing/scaling factor.

Projects that are alternatives of or similar to Image bbox slicer

Robust Detection Benchmark
Code, data and benchmark from the paper "Benchmarking Robustness in Object Detection: Autonomous Driving when Winter is Coming" (NeurIPS 2019 ML4AD)
Stars: ✭ 128 (+212.2%)
Mutual labels:  object-detection, jupyter-notebook, pascal-voc
Voc2coco
How to create custom COCO data set for object detection
Stars: ✭ 140 (+241.46%)
Mutual labels:  object-detection, jupyter-notebook, pascal-voc
Lacmus
Lacmus is a cross-platform application that helps to find people who are lost in the forest using computer vision and neural networks.
Stars: ✭ 142 (+246.34%)
Mutual labels:  object-detection, jupyter-notebook, pascal-voc
Yet Another Efficientdet Pytorch
The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
Stars: ✭ 4,945 (+11960.98%)
Mutual labels:  object-detection, jupyter-notebook
Ssd Tensorflow
Single Shot MultiBox Detector in TensorFlow
Stars: ✭ 4,066 (+9817.07%)
Mutual labels:  object-detection, jupyter-notebook
Practical Deep Learning Book
Official code repo for the O'Reilly Book - Practical Deep Learning for Cloud, Mobile & Edge
Stars: ✭ 441 (+975.61%)
Mutual labels:  object-detection, jupyter-notebook
Object Detection Metrics
Most popular metrics used to evaluate object detection algorithms.
Stars: ✭ 3,888 (+9382.93%)
Mutual labels:  object-detection, pascal-voc
Deep Learning For Hackers
Machine Learning tutorials with TensorFlow 2 and Keras in Python (Jupyter notebooks included) - (LSTMs, Hyperameter tuning, Data preprocessing, Bias-variance tradeoff, Anomaly Detection, Autoencoders, Time Series Forecasting, Object Detection, Sentiment Analysis, Intent Recognition with BERT)
Stars: ✭ 586 (+1329.27%)
Mutual labels:  object-detection, jupyter-notebook
Curve Text Detector
This repository provides train&test code, dataset, det.&rec. annotation, evaluation script, annotation tool, and ranking.
Stars: ✭ 551 (+1243.9%)
Mutual labels:  object-detection, jupyter-notebook
Android Yolo
Real-time object detection on Android using the YOLO network with TensorFlow
Stars: ✭ 604 (+1373.17%)
Mutual labels:  object-detection, pascal-voc
Soft Nms
Object Detection
Stars: ✭ 708 (+1626.83%)
Mutual labels:  jupyter-notebook, pascal-voc
Trainyourownyolo
Train a state-of-the-art yolov3 object detector from scratch!
Stars: ✭ 399 (+873.17%)
Mutual labels:  object-detection, jupyter-notebook
Automl
Google Brain AutoML
Stars: ✭ 4,795 (+11595.12%)
Mutual labels:  object-detection, jupyter-notebook
Fpn
Feature Pyramid Networks for Object Detection
Stars: ✭ 485 (+1082.93%)
Mutual labels:  object-detection, jupyter-notebook
Yolo V5
🎨 Pytorch YOLO v5 训练自己的数据集超详细教程!!! 🎨 (提供PDF训练教程下载)
Stars: ✭ 379 (+824.39%)
Mutual labels:  object-detection, jupyter-notebook
Detectorch
Detectorch - detectron for PyTorch
Stars: ✭ 566 (+1280.49%)
Mutual labels:  object-detection, jupyter-notebook
Openlabeling
Label images and video for Computer Vision applications
Stars: ✭ 706 (+1621.95%)
Mutual labels:  object-detection, pascal-voc
Getting Things Done With Pytorch
Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BERT.
Stars: ✭ 738 (+1700%)
Mutual labels:  object-detection, jupyter-notebook
Keras Faster Rcnn
Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
Stars: ✭ 28 (-31.71%)
Mutual labels:  object-detection, jupyter-notebook
Dota Doai
This repo is the codebase for our team to participate in DOTA related competitions, including rotation and horizontal detection.
Stars: ✭ 326 (+695.12%)
Mutual labels:  object-detection, jupyter-notebook

PyPI version

image_bbox_slicer

This easy-to-use library is a data transformer sometimes useful in Object Detection tasks. It splits images and their bounding box annotations into tiles, both into specific sizes and into any arbitrary number of equal parts. It can also resize them, both by specific sizes and by a resizing/scaling factor. Read the docs here.

Partial Labels Example

Currently, this library only supports bounding box annotations in PASCAL VOC format. And as of now, there is no command line execution support. Please raise an issue if needed.

UPDATE: This tool was only tested on Linux/Ubuntu. Please find a potential fix to make it work on Windows here.

Installation

$ pip install image_bbox_slicer

Works with Python 3.4 and higher versions and requires:

Pillow==5.4.1
numpy==1.16.2
pascal-voc-writer==0.1.4
matplotlib==3.0.3

Usage - A Quick Demo

Note: This usage demo can be found in demo.ipynb in the repo.

import image_bbox_slicer as ibs

Create And Configure Slicer Object

Setting Paths To Source And Destination Directories.

You must configure paths to source and destination directories like the following.

im_src = './src/images'
an_src = './src/annotations'
im_dst = './dst/images'
an_dst = './dst/annotations'

slicer = ibs.Slicer()
slicer.config_dirs(img_src=im_src, ann_src=an_src, 
                   img_dst=im_dst, ann_dst=an_dst)

Dealing With Partial Labels

Partial Labels Example

The above images show the difference in slicing with and without partial labels. In the image on the left, all the box annotations masked in green are called Partial Labels.

Configure your slicer to either ignore or consider them by setting Slicer object's keep_partial_labels instance variable to True or False respectively. By default it is set to False.

slicer.keep_partial_labels = True

Dealing With Empty Tiles

Empty Tiles Example

An empty tile is a tile with no "labels" in it. The definition of "labels" here is tightly coupled with the user's preference of partial labels. If you choose to keep the partial labels (i.e. keep_partial_labels = True), a tile with a partial label is not treated as empty. If you choose to not keep the partial labels (i.e. keep_partial_labels = False), a tile with one or more partial labels is considered empty.

Configure your slicer to either ignore or consider empty tiles by setting Slicer object's ignore_empty_tiles instance variable to True or False respectively. By default it is set to True.

slicer.ignore_empty_tiles = False

Before-After Mapping

You can choose to store the mapping between file names of the images before and after slicing by setting the Slicer object's save_before_after_map instance variable to True. By default it is set to False.

Typically, mapper.csv looks like the following:

| old_name   | new_names                       |
|------------|---------------------------------|
| 2102       | 000001, 000002, 000003, 000004  |
| 3931       | 000005, 000005, 000007, 000008  |
| test_image | 000009, 000010, 000011, 000012  |
| ...        | ...                             |
slicer.save_before_after_map = True

Slicing

Images and Bounding Box Annotations Simultaneously

By Number Of Tiles

slicer.slice_by_number(number_tiles=4)
slicer.visualize_sliced_random()
Output1 Output2

By Specific Size

slicer.slice_by_size(tile_size=(418,279), tile_overlap=0)
slicer.visualize_sliced_random()
Output3 Output4

Note: visualize_sliced_random() randomly picks a recently sliced image from the directory for plotting.

Other Slicing Functions

By Number Of Tiles

slicer.slice_images_by_number(number_tiles=4)

By Specific Size

slicer.slice_images_by_size(tile_size=(418,279), tile_overlap=0)

Slicing Only Bounding Box Annotations

By Number Of Tiles

slicer.slice_bboxes_by_number(number_tiles=4)

By Specifc Size

slicer.slice_bboxes_by_size(tile_size=(418,279), tile_overlap=0)

Resizing

png

Images and Bounding Box Annotations Simultaneously

By Specific Size

slicer.resize_by_size(new_size=(500,200))
slicer.visualize_resized_random()

png

png

By A Resize Factor

slicer.resize_by_factor(resize_factor=0.05)
slicer.visualize_resized_random()

png

png

Note:

visualize_resized_random() randomly picks a recently resized image from the destination directory for plotting.

Other Resizing Functions

Resizing Separately

Only Images

  • By Specific Size

slicer.resize_images_by_size(new_size=(500,200))
  • By Resize Factor

slicer.resize_images_by_factor(resize_factor=0.05)

Only Bounding Box Annotations

  • By Specific Size

slicer.resize_bboxes_by_size(new_size=(500,200))
  • By Resize Factor

slicer.resize_bboxes_by_factor(resize_factor=0.05)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].