scico.flax.examples.data_generation#
Functionality to generate training data for Flax example scripts.
Computation is distributed via ray (if available) or jax or to reduce processing time.
Functions
|
Data generation distributed among processes using jax. |
|
Generate batch of blurred data. |
|
Generate batch of computed tomography (CT) data. |
|
Generate batch of xdesign foam-like structures. |
|
Generate batch of foam2 structures. |
|
Data generation distributed among processes using ray. |
- scico.flax.examples.data_generation.generate_foam2_images(seed, size, ndata)[source]#
Generate batch of foam2 structures.
Generate batch of images with
Foam2
structure (foam-like material with two different attenuations).
- scico.flax.examples.data_generation.generate_foam1_images(seed, size, ndata)[source]#
Generate batch of xdesign foam-like structures.
Generate batch of images with xdesign foam-like structure, which uses one attenuation.
- scico.flax.examples.data_generation.generate_ct_data(nimg, size, nproj, imgfunc=<function generate_foam2_images>, seed=1234, verbose=False, test_flag=False, prefer_ray=True)[source]#
Generate batch of computed tomography (CT) data.
Generate batch of CT data for training of machine learning network models.
- Parameters:
nimg (
int
) – Number of images to generate.size (
int
) – Size of reconstruction images.nproj (
int
) – Number of CT views.imgfunc (
Callable
) – Function for generating input images (e.g. foams).seed (
int
) – Seed for data generation.verbose (
bool
) – Flag indicating whether to print status messages. Default:False
.test_flag (
bool
) – Flag to indicate if running in testing mode. Testing mode requires a different initialization of ray. Default:False
.prefer_ray (
bool
) – Use ray for distributed processing if available. Default:True
.
- Return type:
- Returns:
tuple –
A tuple (img, sino, fbp) containing:
- scico.flax.examples.data_generation.generate_blur_data(nimg, size, blur_kernel, noise_sigma, imgfunc, seed=4321, verbose=False, test_flag=False, prefer_ray=True)[source]#
Generate batch of blurred data.
Generate batch of blurred data for training of machine learning network models.
- Parameters:
nimg (
int
) – Number of images to generate.size (
int
) – Size of reconstruction images.blur_kernel (
Array
) – Kernel for blurring the generated images.noise_sigma (
float
) – Level of additive Gaussian noise to apply.imgfunc (
Callable
) – Function to generate foams.seed (
int
) – Seed for data generation.verbose (
bool
) – Flag indicating whether to print status messages. Default:False
.test_flag (
bool
) – Flag to indicate if running in testing mode. Testing mode requires a different initialization of ray. Default:False
.prefer_ray (
bool
) – Use ray for distributed processing if available. Default:True
.
- Return type:
- Returns:
tuple –
A tuple (img, blurn) containing:
img : Generated foam images.
blurn : Corresponding blurred and noisy images.
- scico.flax.examples.data_generation.distributed_data_generation(imgenf, size, nimg, sharded=True)[source]#
Data generation distributed among processes using jax.
- Parameters:
- Return type:
- Returns:
Array of generated data.
- scico.flax.examples.data_generation.ray_distributed_data_generation(imgenf, size, nimg, seedg=123, test_flag=False)[source]#
Data generation distributed among processes using ray.
- Parameters:
imagenf – Function for batch-data generation.
size (
int
) – Size of image to generate.ndata – Number of images to generate.
seedg (
float
) – Base seed for data generation. Default: 123.test_flag (
bool
) – Flag to indicate if running in testing mode. Testing mode requires a different initialization of ray. Default:False
.
- Return type:
- Returns:
Array of generated data.