Module Datasets.Circles

Synthetic dataset for counting circles in images

module Config : sig ... end
module Random = Rand.Random_for_tests
val draw_circle : image_size:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> int -> int -> int -> unit

Draw a filled circle on the image at (cx, cy) with radius r. Values are clamped to 0, 1 range.

val generate_with_kind : (float, 'a) Stdlib__Bigarray.kind -> ?config:Config.t -> len:int -> unit -> (float, 'a, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t * (float, 'a, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t

Generate circle counting dataset with specified precision.

  • parameter kind

    The bigarray kind (float32 or float64)

  • parameter config

    Configuration for image and circle parameters

  • parameter len

    Number of images to generate

  • returns

    A tuple of (images, labels) where:

    • images is a bigarray of shape len; image_size; image_size; 1 (batch, height, width, channels)
    • labels is a bigarray of shape len; 1 (batch, output) containing the circle count
val generate : ?config:Config.t -> len:int -> unit -> (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t * (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t

Generate circle counting dataset with double precision.

  • parameter config

    Configuration for image and circle parameters

  • parameter len

    Number of images to generate

  • returns

    A tuple of (images, labels) where:

    • images is a bigarray of shape len; image_size; image_size; 1
    • labels is a bigarray of shape len; 1 containing the circle count
val generate_single_prec : ?config:Config.t -> len:int -> unit -> (float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t * (float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t

Generate circle counting dataset with single precision.

  • parameter config

    Configuration for image and circle parameters

  • parameter len

    Number of images to generate

  • returns

    A tuple of (images, labels) where:

    • images is a bigarray of shape len; image_size; image_size; 1 with float32 elements
    • labels is a bigarray of shape len; 1 with float32 elements containing the circle count