peal.web.ingest.build_pair_dataset¶
- peal.web.ingest.build_pair_dataset(class_root, classes, class_a, class_b, out_dir, max_per_class=None, link=True)[source]¶
Write the binary
imgs/<0|1>+data.csvlayout for two classes.class_abecomes label 0 andclass_blabel 1. Images are renamed to<label>/<index:06d><ext>anddata.csvgets the headerImgPath,Class. Symlinks are used by default (the extracted upload stays the owner of the bytes);link=Falsecopies.- Parameters:
class_root (
str) – Directory returned bydiscover_classes.classes (
dict) –{class_name: [relative image paths]}fromdiscover_classes.class_a (
str) – The two class folders to use; must differ and exist inclasses.class_b (
str) – The two class folders to use; must differ and exist inclasses.out_dir (
str) – Dataset root that receivesimgs/anddata.csv.max_per_class (
int, optional) – Truncate each class to its firstmax_per_classimages.link (
bool) – Symlink (True) or copy (False) the images.
- Returns:
{class_name: number of images used}for the two classes.- Return type:
- Raises:
IngestError – If the classes are equal or unknown.