https://github.com/mbari-org/blaise
A utility to crop images according to given annotations ("blazingly fast")
https://github.com/mbari-org/blaise
classification image-processing pascal-voc rust
Last synced: 3 months ago
JSON representation
A utility to crop images according to given annotations ("blazingly fast")
- Host: GitHub
- URL: https://github.com/mbari-org/blaise
- Owner: mbari-org
- Created: 2022-11-21T05:03:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-04T03:10:11.000Z (almost 2 years ago)
- Last Synced: 2025-10-20T01:17:40.740Z (8 months ago)
- Topics: classification, image-processing, pascal-voc, rust
- Language: Rust
- Homepage:
- Size: 355 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# blaise
A Rust implementation of [voc-cropper](https://github.com/mbari-org/voc-cropper).
This repo started as a learning exercise on how things like xml parsing and basic image processing
can be done in Rust. Along with the use of Rust mechanisms for CLI, file handling, multithreading,
progress report, etc., it only intended to reproduce the main functionality in voc-imagecropper,
but more features were subsequently added.
Notable differences wrt voc-imagecropper include:
- cropped images are written out in png format (not in jpeg)
- no checks for minimum size
- no summary of average of the images
- for location of the images, along with the `--image-dir` option, only the `filename` attribute
is used from the xml
- blaise can also ingest annotations in Yolo format (option `--yolo`)
(translation logic adopted from [yolo_to_voc.py](
https://bitbucket.org/mbari/m3-download/src/main/scripts/yolo_to_voc.py))
- some additional options:
- `--bb-info `
- `--max-ar `
- `-j` to indicate number of threads to use
## Installation
A GitHub workflow builds and [releases](../../releases/) Linux and macOS binaries
of the program.
Alternatively, with Rust on your system, you can clone this repo and run:
```shell
cargo build --release
cargo install --path .
```
This should put the executable in your `~/.cargo/bin` directory.
Then, run `blaise --help` to see the usage.
Simple example:
```shell
blaise --pascal data/annotations --image-dir data/imgs --output-dir data/out
```
## Usage
```shell
blaise --help
```
```text
Creates image crops for given annotations
Usage: blaise [OPTIONS] --output-dir
Options:
-p, --pascal
Base directory to scan for pascal voc annotations
-y, --yolo
Use yolo annotations
-i, --image-dir
Image base directory
--max-ar
Only process images having at most the given aspect ratio
-r, --resize
Resize the resulting crops (aspect ratio not necessarily preserved)
-L, --select-labels
Comma separated list of labels to crop. Defaults to everything
-o, --output-dir
Path to store image crops
-b, --bb-info
Generate csv with size, aspect ratio of loaded bounding boxes
--verbose
Verbose output (disables progress bars)
--npb
Do not show progress bars
-j
Number of threads to use (by default, all available)
-h, --help
Print help
-V, --version
Print version
```
## Development
We use [just](https://github.com/casey/just) for [various tasks](justfile).
Run `just list` to see the available recipes.
```shell
$ just list
Available recipes:
default # A convenient default for development: test and format
all # default + clippy; good to run before committing changes
list # List recipes
check # cargo check
test # Run tests
test-nocapture # Run tests with --nocapture
run *args='-p data -o data/out' # Run program with basic example
rrun *args='-p data -o data/out' # Run program in release mode
tgz # Package source code
format # Format source code
clippy # Run clippy
build *args='--release' # Build
install # Install
outdated # Show outdated dependencies
udeps # Find unused dependencies
update # cargo update
```
In particular, be sure to run `just all`
before committing/pushing any changes.
## Misc links/refs
-
-
-
-
-
-