Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataFrame
  • PyFlink Multimodal
    • Image
    • Video
    • Utilities
  • PyFlink DataStream
  • PyFlink Common

pyflink.multimodal.operators.image_watermark_score#

image_watermark_score(*columns, hf_watermark_model='amrul-hzz/watermark_detector', model_sharing=None, concurrency=None, batch_size=None, num_gpus=None, gpu_type=None)[source]#

Create a watermark scoring UDF (HuggingFace image classification-based).

Requires pip install transformers torch. This is a pandas batch UDF that supports GPU acceleration via num_gpus / gpu_type. Set num_gpus to request GPU resources from the DataFrame UDF runtime.

Parameters
  • *columns – Optional image column(s). When provided, the UDF is applied directly instead of returning a factory.

  • hf_watermark_model – HuggingFace model ID for watermark detection. Defaults to the built-in watermark classifier model.

  • model_sharing – Model sharing mode across parallel subtasks. None uses per-process caching.

  • concurrency – UDF concurrency. None uses the framework default.

  • batch_size – Pandas batch size. None uses the framework default.

  • num_gpus – Fractional GPU count per subtask, e.g. 0.5. None runs on CPU.

  • gpu_type – Required GPU type, e.g. "A10". None accepts any available GPU.

Returns

A UDF that returns a float watermark probability score in [0, 1] or None for null inputs. Higher values indicate stronger watermark confidence. Use downstream filtering (e.g. > 0.8) to convert to a boolean decision.

Example::
>>> # As a reusable variable
>>> watermark = image_watermark_score()
>>> df = df.with_column("wm", watermark(col("img")))
>>> watermark_gpu = image_watermark_score(num_gpus=1.0)
>>> df = df.with_column("wm", watermark_gpu(col("img")))
>>>
>>> # Inline
>>> df = df.with_column("wm", image_watermark_score(col("img")))
>>> df = df.filter(image_watermark_score(col("img")) > 0.8)

previous

pyflink.multimodal.operators.image_quality_score

next

pyflink.multimodal.operators.image_embedding

Show Source

Created using Sphinx 4.5.0.