ivapylibs / Surveillance

The surveillance system for the SuperviseIt project
0 stars 1 forks source link

Help with lambdas: Want no-op for Puzzle_Residual #17

Open pv33 opened 2 years ago

pv33 commented 2 years ago

Current puzzle parameters in default_params.py

# parameters - puzzle
kernel = np.ones((15, 15), np.uint8)
mask_proc_puzzle_seg = maskproc(
    maskproc.opening, (kernel,),
    maskproc.closing, (kernel,),
)
PPARAMS = Puzzle_Seg.Params_Residual(
    postprocessor=lambda mask: \
        mask_proc_puzzle_seg.apply(mask.astype(bool))
)

How can I set to be a no-op? I thought of setting to None, but not sure if lambda and None are compatible.

Or, if I understand code, then does the following work:

PPARAMS = Puzzle_Seg.Params_Residual()

such that a sensible default will apply?

This might be source of flicker in the puzzle segmentation mask. The morphological kernel is somewhat large. Want to see raw results by disabling.

@yiyeChen

yiyeChen commented 2 years ago

Yes using the default will work (do nothing).

Or you can change the lambda function to be the following, which will also do nothing. Actually that is exactly the default lambda function in the first option.

lambda mask: mask