data_juicer.ops.mapper.image_segment_mapper module

class data_juicer.ops.mapper.image_segment_mapper.ImageSegmentMapper(imgsz=1024, conf=0.05, iou=0.5, model_path='FastSAM-x.pt', *args, **kwargs)[source]

Bases: Mapper

Perform segment-anything on images and return the bounding boxes.

__init__(imgsz=1024, conf=0.05, iou=0.5, model_path='FastSAM-x.pt', *args, **kwargs)[source]

Initialization method.

Parameters:
  • imgsz – resolution for image resizing

  • conf – confidence score threshold

  • iou – IoU (Intersection over Union) score threshold

  • model_path – the path to the FastSAM model. Model name should be one of [‘FastSAM-x.pt’, ‘FastSAM-s.pt’].

process_single(sample, rank=None, context=False)[source]

For sample level, sample –> sample

Parameters:

sample – sample to process

Returns:

processed sample