A simple python module to generate anchor (aka default/prior) boxes for object detection tasks.

Overview

PyBx

WIP

A simple python module to generate anchor (aka default/prior) boxes for object detection tasks. Calculated anchor boxes are returned as ndarrays in pascal_voc format by default.

Installation

pip install pybx

Usage

To calculate the anchor boxes for a single feature size and aspect ratio, given the image size:

from pybx import anchor

image_sz = (300, 300, 3)
feature_sz = (10, 10)
asp_ratio = 1/2.

anchor.bx(image_sz, feature_sz, asp_ratio)

To calculate anchor boxes for multiple feature sizes and aspect ratios:

feature_szs = [(10, 10), (8, 8)]
asp_ratios = [1., 1/2., 2.]

anchor.bxs(image_sz, feature_szs, asp_ratios)

More on visualising the anchor boxes here.

Todo

  • Wrapper class for boxes with vis.draw() method
  • Companion notebook
  • IOU check (return best overlap boxes)
  • Return masks
  • Unit tests
  • Specific tests
    • feature_sz of different aspect ratios
    • image_sz of different aspect ratios
  • Move to setup.py
Comments
  • Build and refactor [nbdev]

    Build and refactor [nbdev]

    A refactored version of pybx built using nbdev.

    Added:

    • documentation page: docs, README.md, example walkthrough file
    • GH workflow tests

    Breaking changes:

    • Need area() and valid() are now properties of BaseBx, so .area and .valid would suffice
    • utils methods refactored to utils and ops
    opened by thatgeeman 0
  • Walkthrough issue for PIL mode.

    Walkthrough issue for PIL mode.

    In the step: Ask VisBx to use random logits with logits=True

    vis.VisBx(image_sz=image_sz, logits=True, feature_sz=feature_sz).show(anchors, labels)
    

    Returns a key error: KeyError: ((1, 1, 3), '<i8') and TypeError: Cannot handle this data type: (1, 1, 3), <i8 with PIL.

    good first issue 
    opened by thatgeeman 0
  • Patch 4: Docs, Improvements, Bug fixes

    Patch 4: Docs, Improvements, Bug fixes

    • Refactored major sections of pybx.basics and the BxType
    • Backwards incompatible!
    • Detailed docstrings for all methods and classes
    • Directly visualize arrays in VisBx()
    • Visualize, iterate, __add__ operations for BaseBx
    • Helper function to set and return BxType (get_bx)
    • Several verbal assertions and bug fixes
    • Fixes #3 #2
    • [dev] Updated tests
    opened by thatgeeman 0
  • TypeError: 'BaseBx' object is not iterable

    TypeError: 'BaseBx' object is not iterable

    Describe the bug draw method of vis module tries to iterate over BaseBx during visualisation

    To Reproduce Steps to reproduce the behavior:

    anns = {'label': 5,
     'x_min': 87.0,
     'y_min': 196.0,
     'x_max': 1013.0,
     'y_max': 2129.0}
    
    from pybx.ops import make_array
    coords, label = make_array(anns)
    
    b = bbx(coords, label)
    vis.draw(img, b)
    
    opened by thatgeeman 0
  • implemented IOU for `BaseBx` and added unittests

    implemented IOU for `BaseBx` and added unittests

    Main commits

    • implemented intersection-over-union (IOU) for BaseBx
    • added unittests for all modules
    • Implemented classmethod and bbx() for BaseBx class to convert all types to BaseBx
    • ops now handles all type conversions (json-array, list-array)
    • bug fixes, best caught:
      • BaseBx method xywh() flipped w and h
      • read keys in order of voc_keys for json annotations)
    • updated README.md and nbs/
    opened by thatgeeman 0
  • Region proposals

    Region proposals

    Is your feature request related to a problem? Please describe. Rather than creating a bunch of anchor boxes based on geometry, create region proposals based on classic signal processing.

    opened by thatgeeman 0
  • Fix notebook (walkthrough)

    Fix notebook (walkthrough)

    Describe the bug

    • [ ] walkthrough link fails
    • [ ] Code import os bug

    To Reproduce Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here.

    opened by thatgeeman 0
  • Missing sidebar in documentation page

    Missing sidebar in documentation page

    Describe the bug A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here.

    opened by thatgeeman 0
Releases(v0.3.0)
  • v0.3.0(Nov 20, 2022)

    A refactored version of pybx built using nbdev.

    Added:

    • documentation page: docs, README.md, example walkthrough file
    • GH workflow tests

    Breaking changes:

    • Need area() and valid() are now properties of BaseBx, so .area and .valid would suffice
    • utils methods refactored to utils and ops
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Jan 21, 2022)

    What's Changed

    • Patch 5: Minor fixes by @thatgeeman in https://github.com/thatgeeman/pybx/pull/5
    • Patch 4: Docs, Improvements, Bug fixes by @thatgeeman in https://github.com/thatgeeman/pybx/pull/4

    Full Changelog: https://github.com/thatgeeman/pybx/compare/v0.1.4...v0.2.1

    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(Jan 18, 2022)

    What's Changed

    • implemented IOU for BaseBx and added unittests by @thatgeeman in https://github.com/thatgeeman/pybx/pull/1

    New Contributors

    • @thatgeeman made their first contribution in https://github.com/thatgeeman/pybx/pull/1

    Full Changelog: https://github.com/thatgeeman/pybx/compare/v0.1.3...v0.1.4

    Source code(tar.gz)
    Source code(zip)
Owner
thatgeeman
Physics PhD. Previously @CharlesSadron @CNRS @unistra. Computer Vision.
thatgeeman
Official implementation of "Dynamic Anchor Learning for Arbitrary-Oriented Object Detection" (AAAI2021).

DAL This project hosts the official implementation for our AAAI 2021 paper: Dynamic Anchor Learning for Arbitrary-Oriented Object Detection [arxiv] [c

ming71 215 Nov 28, 2022
DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Object Detection

DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Object Detection Code for our Paper DAFNe: A One-Stage Anchor-Free Deep Model for Oriented Obje

Steven Lang 58 Dec 19, 2022
[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

BCMI 49 Jul 27, 2022
aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

Bayesian Methods for Hackers Using Python and PyMC The Bayesian method is the natural approach to inference, yet it is hidden from readers behind chap

Cameron Davidson-Pilon 25.1k Jan 2, 2023
PyTorch implementation for the visual prior component (i.e. perception module) of the Visually Grounded Physics Learner [Li et al., 2020].

VGPL-Visual-Prior PyTorch implementation for the visual prior component (i.e. perception module) of the Visually Grounded Physics Learner (VGPL). Give

Toru 8 Dec 29, 2022
CenterFace(size of 7.3MB) is a practical anchor-free face detection and alignment method for edge devices.

CenterFace Introduce CenterFace(size of 7.3MB) is a practical anchor-free face detection and alignment method for edge devices. Recent Update 2019.09.

StarClouds 1.2k Dec 21, 2022
PyTorch implemention of ICCV'21 paper SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation

SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation This is the PyTorch implemention of ICCV'21 paper SGPA: Structure

Chen Kai 24 Dec 5, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022
This repository is based on Ultralytics/yolov5, with adjustments to enable polygon prediction boxes.

Polygon-Yolov5 This repository is based on Ultralytics/yolov5, with adjustments to enable polygon prediction boxes. Section I. Description The codes a

xinzelee 226 Jan 5, 2023
This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes.

Rotate-Yolov5 This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes. Section I. Description The codes are

xinzelee 90 Dec 13, 2022
PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation

PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation The paper: https://arxiv.org/abs/1704.03296 What makes

Jacob Gildenblat 322 Dec 17, 2022
labelpix is a graphical image labeling interface for drawing bounding boxes

Welcome to labelpix ?? labelpix is a graphical image labeling interface for drawing bounding boxes. ?? Homepage Install pip install -r requirements.tx

schissmantics 26 May 24, 2022
Pytorch based library to rank predicted bounding boxes using text/image user's prompts.

pytorch_clip_bbox: Implementation of the CLIP guided bbox ranking for Object Detection. Pytorch based library to rank predicted bounding boxes using t

Sergei Belousov 50 Nov 27, 2022
Pytorch ImageNet1k Loader with Bounding Boxes.

ImageNet 1K Bounding Boxes For some experiments, you might wanna pass only the background of imagenet images vs passing only the foreground. Here, I'v

Amin Ghiasi 11 Oct 15, 2022
TorchDistiller - a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

This project is a collection of the open source pytorch code for knowledge distillation, especially for the perception tasks, including semantic segmentation, depth estimation, object detection and instance segmentation.

yifan liu 147 Dec 3, 2022
Code for CVPR 2021 paper: Anchor-Free Person Search

Introduction This is the implementationn for Anchor-Free Person Search in CVPR2021 License This project is released under the Apache 2.0 license. Inst

null 158 Jan 4, 2023
Code for CVPR2021 paper "Learning Salient Boundary Feature for Anchor-free Temporal Action Localization"

AFSD: Learning Salient Boundary Feature for Anchor-free Temporal Action Localization This is an official implementation in PyTorch of AFSD. Our paper

Tencent YouTu Research 146 Dec 24, 2022