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, classes=["cat", "dog"]) # max_samples=100
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 = {"dataset_name": "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.6.tar.gz
(11.9 kB
view details)
Built Distribution
hello2-0.1.6-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file hello2-0.1.6.tar.gz
.
File metadata
- Download URL: hello2-0.1.6.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31706ae112260c0e9f932b4a99e3066b0ea7fe44e386c0c8b0a5a9c3e78a74f1 |
|
MD5 | 76d6ed6ec1151d1623281718c9c4c935 |
|
BLAKE2b-256 | 8b38f217691fc7eece918ec91407a94e23ba04ccf51538f06cad2fcb038134e2 |
File details
Details for the file hello2-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: hello2-0.1.6-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b05dbd79fb218763a4c9577f22684e3e33261db97302c441bf919f9edf0321a |
|
MD5 | 676cb470c4f2ed0263b84c0efe8b2397 |
|
BLAKE2b-256 | 489e63aa2f509eab706a441f40bca5f0dc51117f466412b5775b637f04d95a06 |