cellmap_flow.dashboard.routes.finetune.good_regions

Regions the user has looked at and judged the model already handles well.

These are the counterweight to corrections. Painted scribbles say “you got this wrong, here”; a good region says “you got this right, here, and I checked”. Training samples patches from both: the scribbles supply the supervised signal, and the good regions supply rehearsal – patches with no annotation at all, which the trainer already treats correctly (an empty mask zeroes the supervised term and hands the whole patch to the distillation term against the frozen teacher).

Kept deliberately separate from imported_crops: those carry real labels, these carry only a human’s assertion that the model’s own output is acceptable there. Both are evidence, but not the same kind.

Routes: GET /api/finetune/good-regions (the session’s regions), POST /api/finetune/good-regions/mark-view (a box where the viewer looks) and POST /api/finetune/good-regions/delete (one region by id, or all).

Attributes

logger

GOOD_REGIONS_LAYER

DEFAULT_REGION_SIZE_NM

Functions

load_good_regions()

save_good_regions(regions)

view_box_nm([size_nm])

(centre_nm, size_nm) of the box centred where the viewer looks.

mark_current_view_good()

Record a box centred on wherever the viewer is looking right now.

list_good_regions()

delete_good_region()

refresh_good_regions_layer([regions])

Draw the good regions in the viewer so you can see what you marked.

Module Contents

cellmap_flow.dashboard.routes.finetune.good_regions.logger
cellmap_flow.dashboard.routes.finetune.good_regions.GOOD_REGIONS_LAYER = 'good_regions'
cellmap_flow.dashboard.routes.finetune.good_regions.DEFAULT_REGION_SIZE_NM = 896.0
cellmap_flow.dashboard.routes.finetune.good_regions.load_good_regions()
cellmap_flow.dashboard.routes.finetune.good_regions.save_good_regions(regions)
cellmap_flow.dashboard.routes.finetune.good_regions.view_box_nm(size_nm=None)

(centre_nm, size_nm) of the box centred where the viewer looks.

size_nm defaults to one model output patch (see DEFAULT_REGION_SIZE_NM); one number is the same along every axis. The labelling buttons beside “Mark This View as Good” use the same box, so what they label is what a mark would cover. ValueError when there is no viewer position or the size is not positive.

cellmap_flow.dashboard.routes.finetune.good_regions.mark_current_view_good()

Record a box centred on wherever the viewer is looking right now.

cellmap_flow.dashboard.routes.finetune.good_regions.list_good_regions()
cellmap_flow.dashboard.routes.finetune.good_regions.delete_good_region()
cellmap_flow.dashboard.routes.finetune.good_regions.refresh_good_regions_layer(regions=None)

Draw the good regions in the viewer so you can see what you marked.