scico.flax.examples.data_generation¶
Functionality to generate training data for Flax example scripts.
Computation is distributed via ray to reduce processing time.
Functions
|
Distribute application of operator over a batch of vectors |
|
Data generation distributed among processes using ray. |
|
Generate batch of blurred data. |
|
Generate batch of computed tomography (CT) data. |
|
Generate batch of xdesign foam-like structures. |
|
Generate batch of foam2 structures. |
|
Vectorize application of operator. |
Classes
|
Foam-like material with two attenuations. |
|
- class scico.flax.examples.data_generation.Foam2(size_range=[0.05, 0.01], gap=0, porosity=1, attn1=1.0, attn2=10.0)[source]¶
Bases:
UnitCircleFoam-like material with two attenuations.
Define functionality to generate phantom with structure similar to foam with two different attenuation properties.
Foam-like structure with two different attenuations. Circles for material 1 are more sparse than for material 2 by design.
- Parameters:
size_range (
Union[float,List[float]]) – The radius, or range of radius, of the circles to be added. Default: [0.05, 0.01].gap (
float) – Minimum distance between circle boundaries. Default: 0.porosity (
float) – Target porosity. Must be a value between [0, 1]. Default: 1.attn1 (
float) – Mass attenuation parameter for material 1. Default: 1.attn2 (
float) – Mass attenuation parameter for material 2. Default: 10.
- 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_foam2_images(seed, size, ndata)[source]¶
Generate batch of foam2 structures.
Generate batch of images with
Foam2structure (foam-like material with two different attenuations).
- scico.flax.examples.data_generation.batched_f(f_, vr)[source]¶
- Distribute application of operator over a batch of vectors
among available processes.
- scico.flax.examples.data_generation.generate_ct_data(nimg, size, nproj, imgfunc=<function generate_foam2_images>, seed=1234, verbose=False)[source]¶
Generate batch of computed tomography (CT) data.
Generate batch of CT data for training of machine learning network models.
- Parameters:
- 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=<function generate_foam1_images>, seed=4321, verbose=False)[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.
- 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, seedg=123)[source]¶
Data generation distributed among processes using ray.
Warning: callable imgenf should not make use of any jax functions to avoid the risk of errors when running with GPU devices, in which case jax is initialized to expect the availability of GPUs, which are then not available within the ray.remote function due to the absence of any declared GPUs as a num_gpus parameter of @ray.remote.