The cocotools
crate provides tools to load, manipulate/convert and visualize COCO format datasets.
Get the crate from crates.io.
You can find the documentation here.
``` use std::path::PathBuf; use cocotools::COCO;
let annotationsfilepath = PathBuf::from("../datasamples/coco25k/annotations.json"); let imagefolderpath = PathBuf::from("../datasamples/coco25k/images"); let cocodataset = COCO::new(&annotationsfilepath, &imagefolderpath)?; let filename = dataset.getimg(17627)?.filename; ```
cargo run -- visualize ../data_samples/coco_25k/annotations.json ../data_samples/coco_25k/images -s 000000017627
cargo run -- convert-segmentation ../data_samples/coco_25k/annotations.json rle -o annotations_rle.json