Data for instance segmentation: tell the objects apart, not just find them
Description
Masks stored one file per object, read as a label map that keeps each object’s identity instead of uniting them into one foreground. The question this answers is how many nuclei, and how big is each one, which a semantic mask cannot answer however good it is: two touching nuclei are one region in it.
Usage
instance_data(
train,
validation = NULL,
test = NULL,
split = NULL,
mode = c("nested_dirs", "config_file"),
window = NULL,
subdirs = c("images", "masks"),
column_sep = ";",
shuffle = TRUE
)
Arguments
train
|
Training data: a directory, a configuration file, or a platypus_split from split_dataset(), which carries its own validation set and division.
|
validation
|
A validation set, or FALSE for none. Exactly one of validation and split, and neither when train is already a platypus_split.
|
test
|
A test set to predict on. Scored only if it carries masks.
|
split
|
Divide train instead of naming a validation set: a list with fractions (two numbers, or three to cut a test set too) and group_by, which is required and may be NULL. Exactly one of split and validation.
|
mode
|
“nested_dirs” or “config_file”.
|
window
|
How values in real units reach the model, for DICOM and NIfTI. See segmentation_data().
|
subdirs
|
For nested_dirs, the names of the image and mask subdirectories. The second one holds one file per object rather than one mask per image, which is the layout this task is named for.
|
column_sep
|
For config_file, what separates several paths in one cell.
|
shuffle
|
Shuffle the training data between epochs.
|
Details
Why this exists rather than an argument on segmentation_data(). Every field instance_data() takes, that one takes too - what makes it a different constructor is the five it refuses: colormap, labels, regions, channels_from and target_spacing do not apply to a directory of per-object masks, and the engine rejects them by name. A constructor whose contract is "these five do not apply" is a contract rather than a label, and it gets that refusal from its own argument list rather than from a table somebody has to keep in step.
The consequence worth knowing before you choose: task is still read off the constructors rather than typed. Calling this one is how a specification says it is about instances, so there is no task = “instance_segmentation” to write and nothing to keep in agreement with it. See platypus_spec().
What the model does with this is the other half, and it is one block: a model’s separation says what the network predicts - rim or flows - and decode says how those channels become objects. Neither belongs here, because they describe the run and not the data.
Examples
$train_path
[1] "stage1_train/"
$validation_path
[1] "stage1_validation/"
$validation
NULL
$test_path
NULL
$split
NULL
$mode
NULL
$window
NULL
$subdirs
NULL
$column_sep
NULL
$shuffle
NULL
attr(,"class")
[1] "platypus_instance_data" "list"
attr(,"task")
[1] "instance_segmentation"