A collection of useful tools!
Project description
Hello
A collection of useful tools!
pip install hello2
hello.data
python -m hello.data coco2yolo -h
COCO to YOLO
positional arguments:
coco_dir dataset root dir
optional arguments:
-h, --help show this help message and exit
-j JSON_DIR, --json_dir JSON_DIR
coco json file dir
--classes CLASSES [CLASSES ...]
filter by class: --classes c0 c2 c3
hello.fiftyone
import fiftyone.zoo as foz
from hello.fiftyone.utils import *
# Download and load COCO-2017
label_types = ("detections", "segmentations")
dataset = foz.load_zoo_dataset("coco-2017", label_types=label_types)
print(dataset)
# clone sample field
dataset = clone_sample_field(dataset, "detections", "ground_truth")
print(dataset)
# map labels
mapping = {"cat": "CAT", "dog": "DOG", "person": "PERSON", "*": "OTHER"}
cat_dog_person = map_labels(dataset, mapping, "ground_truth")
print(cat_dog_person.count_values("ground_truth.detections.label"))
# filter samples
classes = ["CAT", "DOG", "PERSON"]
cat_dog_person = filter_samples(cat_dog_person, classes, field_name="ground_truth")
print(cat_dog_person.count_values("ground_truth.detections.label"))
# filter labels
classes = ["CAT", "DOG", "PERSON"]
cat_dog_person = filter_labels(cat_dog_person, classes, field_name="ground_truth")
print(cat_dog_person.count_values("ground_truth.detections.label"))
# merge datasets
classes = ["CAT", "DOG", "PERSON", "OTHER"]
info = {"description": "COCO 2017",
"version": "1.0"}
big_dataset = merge_datasets("big", classes, info, [cat_dog_person])
print(big_dataset.count_values("tags"))
# split dataset
splits = {"train": 0.8, "val": 0.1}
split_dataset(big_dataset, splits=splits, limit=200, field_name="ground_truth")
print(big_dataset.count_values("tags"))
# export dataset
results = export_dataset("/workspace/tmp/big", big_dataset, "ground_truth")
print(results)
# load dataset
test = load_dataset("/workspace/tmp/big/test", label_field="ground_truth")
print(test.count_values("tags"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hello2-0.1.5.tar.gz
(11.2 kB
view details)
Built Distribution
hello2-0.1.5-py3-none-any.whl
(11.8 kB
view details)
File details
Details for the file hello2-0.1.5.tar.gz
.
File metadata
- Download URL: hello2-0.1.5.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75facee5b4b0d56c10d779e31bfd2d5b033a5264f8fe362be3a386970dd73655 |
|
MD5 | 6ce31e2b3777fdca8a9b00d8dfb058b9 |
|
BLAKE2b-256 | a44882402deae95ef0a7f30f9542bd5de0f6cdaed77db1c911998b80a8d0aaf8 |
File details
Details for the file hello2-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: hello2-0.1.5-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 605e45916cf753488270987e8f33fbca0dd128c39d2d28331415f621a46c49ce |
|
MD5 | de9de007c9305c50221e45e12a57ef3b |
|
BLAKE2b-256 | a083becfd92397f29d5ade4cda6647b652e6b148bd99590027ade52ad06ac6c0 |