Open ManuBN786 opened 3 months ago
Hi, you need to add the option to generate a synthetic sample from the BioSR dataset. Using the generate_syntetic_sample function, you need to change the part of the code that says to load image net data. There you need to change the file read from imagenet to biosr (load the npz and load one image of the array). This function will generate the psf for the widefield image and the confocal image.
ix = np.random.randint(0, len(im_net_paths)) path = str(im_net_paths[ix]) img = cv2.imread(path) img = cv2.resize(img, (shape_img[1], shape_img[0]), interpolation=cv2.INTER_AREA) img_gray = np.expand_dims(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), axis=0) / 255.
this is the code you need to change. As for the parameters, n_batches is how many folders of n_samples you want to have, shape_img is the size of your image, and kernel_shape is the size of the kernel, for the case of biosr is 256x256 for both, although the kernel can be smaller. Store all data as you need it for training, as the training script will also run the forward convolution model to train the model. Once you have the generated PSFs, run the training script. As you can see from the trainer the code will read the biosr npz obtain the 'y' tensor (your GT) apply the forward model to obtain the inputs and run the physics-informed optimization.
I tried to generate a psf from the code.
I used:
generate_training_set(10,1,(256,256,1),(256,256),None)
& tried to visualize PSF generated from it.
But it says that some value is too large.
How to fix this ?
How to actually give values to generate a psf?
I get the same " too large try a small one" even if I mention a the path of the biosr test.npz
generate_training_set(10680,100,(256,256),(256,256),paths="/data/BioSR/npz_folder/")
I have downloaded BioSR train & test .npz from the links you provided.
Can you please provide examples to generate training datasets using :
generate_training_set(n_samples, n_batches, sample_shape, kernel_shape, paths=None)
and
generate_synthetic_sample()
how to define n_batches, sample_shape, shape_img & kernel_shapes for BioSR please?