Utils#
This module contains the loss functions used in the project.
Auto Padding#
Make N tuple#
- fusionlab.utils.make_ntuple(x, n)[source]#
Make n-tuple from input x. If x is an iterable, then we just convert it to tuple. Otherwise, we will make a tuple of length n, all with value of x. reference: pytorch/vision
- Parameters:
x (Any) – input value
n (int) – length of the resulting tuple
- Return type:
Tuple[Any, …]
Show Class Tree#
Plot channels#
Convert LabelMe json to Mask#
- fusionlab.utils.convert_labelme_json2mask(class_names, json_dir, output_dir, single_mask=True)[source]#
Convert labelme json files to mask files(.png)
- Parameters:
class_names (list) – list of class names, background class must be included at first
json_dir (str) – path to json files directory
output_dir (str) – path to output directory
single_mask (bool) – if True, save single mask file with class index(uint8), otherwise save multiple mask files with class index(uint8)