.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_generatedata.py: Supplementary 01: Generate data for examples ============================================ This script generates 100 training images, 25 validation images, and 10 testing images to train MS-D networks with. .. code-block:: default import numpy as np import tifffile import os n = 256 nit = 24 np.random.seed(12345) sz = n//8 def generate(): im = np.zeros((n,n),dtype=np.float32) l = np.zeros((n,n),dtype=np.uint8) tmpl = np.zeros((4,sz,sz),dtype=np.float32) tmpl[0] = 1 tmpl[1] = 1 tmpl[1][sz//4:-sz//4,sz//4:-sz//4]=0 xx,yy = np.mgrid[-1:1:1j*sz,-1:1:1j*sz] tmpl[2] = xx**2+yy**2<1 tmpl[3] = xx**2+yy**2<1 tmpl[3][xx**2+yy**2<0.25]=0 i = 0 tp = 0 while i` .. container:: sphx-glr-download :download:`Download Jupyter notebook: generatedata.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_