train
|
Path to the training data: a directory of class directories in “nested_dirs” mode, or a CSV in “config_file” mode.
|
validation
|
Path to the validation data, or FALSE to train without one.
|
classes
|
The class names, in class order. Position is the class index the model learns, which is why it is written rather than read off the directory listing: taken from the filesystem the order would be alphabetical - reproducible, and unrelated to anything - so a model trained where index 1 meant “benign” and used where it means “malignant” reports plausible probabilities and nothing downstream can tell.
In “nested_dirs” mode these are the directory names. At least two, where detection_data() allows one: a detector with one class answers where are the cells, which is a question, and a classifier with one class answers is this a cell with the only answer it has.
There is no background entry. An image is one of these, and a picture of nothing in particular is a class somebody has to name.
|
labels_from
|
One CSV column per class, in class order, each cell 0 or 1 - the layout for a label that is a set. Position in this list is paired with classes, so the headers may be called whatever the dataset calls them and the model still learns the classes in the order you named; stated rather than read off the header row for channels_from’s reason, that sorting is reproducible and clinically meaningless.
“config_file” mode only, and that is a refusal rather than a gap: an image cannot sit in two directories without being two files, so nested_dirs cannot express a set of labels at all. strict_labels has nothing to choose between here - the columns are the classes - and is refused rather than ignored.
A cell that is not 0, 1, 0.0 or 1.0 is refused by name, and the case that is written for is -1: the datasets shaped this way write -1 for uncertain and leave the cell empty for not mentioned, both of which have a defensible mapping to 0 or to 1, which is exactly why the reader must not pick one for you. An image with none of the findings is an ordinary labelled row, written as a line of zeros.
There is no threshold, and metric_accuracy() is refused. Each class decides for itself at a probability of 0.5, and a threshold is a number about your data rather than one this format should invent. Accuracy is refused outright rather than redefined: measured on 4000 images with findings at 10%, 5%, 3% and 2%, a model answering no to everything scores 0.8137 on exact match and 0.9507 per class, above a model holding half the available signal - so neither reading can be what a monitor watches. Use metric_balanced_accuracy(), metric_f1() or metric_auc().
|
test
|
Path to a held-out set, scored but never trained on.
|
split
|
A split() block, to cut a validation and test set out of the training data. For this task the cut is stratified by the engine, so every class reaches every side - a random 70/15/15 of 100 images at a 3% prevalence leaves some part with none of the rare class 91% of the time, and a per-class metric cannot average over a class its pass never held.
|
mode
|
“nested_dirs” or “config_file”.
|
strict_labels
|
Refuse an image whose label is not in classes. FALSE skips it instead, which is how to train on two of a dataset’s three classes without moving any files. It matters more here than it does for a box: a skipped object leaves the rest of its image in the training set, while a skipped image leaves nothing, so the same setting quietly changes how much data there is.
Refused beside labels_from, where the state it chooses between cannot arise: the columns are the classes, so there is no cell that could hold a class nobody named.
|
window
|
How values in real units reach the model, for DICOM and NIfTI - see segmentation_data(), which documents the named windows. Ignored for ordinary pictures.
|
subdirs
|
Refused, and named rather than dropped because every sibling data constructor has it. For segmentation and detection a sample is a directory with the image in one subdirectory and what labels it in the other; a classification sample is one image whose label is the directory it sits in, so there is no second subdirectory.
|
column_sep
|
For config_file, what separates several paths in one cell.
|
shuffle
|
Shuffle the training data between epochs.
|