{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"%pip install pytorch-fid","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from kaggle_secrets import UserSecretsClient\nuser_secrets = UserSecretsClient()\nuser_credential = user_secrets.get_gcloud_credential()\nuser_secrets.set_tensorflow_credential(user_credential)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torchvision\n\ntry:\n    from torchvision.models.utils import load_state_dict_from_url\nexcept ImportError:\n    from torch.utils.model_zoo import load_url as load_state_dict_from_url\n\nFID_WEIGHTS_URL = 'https://github.com/mseitzer/pytorch-fid/releases/download/fid_weights/pt_inception-2015-12-05-6726825d.pth'  # noqa: E501\n\n\nclass InceptionV3(nn.Module):\n    DEFAULT_BLOCK_INDEX = 3\n\n    BLOCK_INDEX_BY_DIM = {\n        64: 0,   # First max pooling features\n        192: 1,  # Second max pooling featurs\n        768: 2,  # Pre-aux classifier features\n        2048: 3  # Final average pooling features\n    }\n\n    def __init__(self,\n                 output_blocks=(DEFAULT_BLOCK_INDEX,),\n                 resize_input=True,\n                 normalize_input=True,\n                 requires_grad=False,\n                 use_fid_inception=True):\n        super(InceptionV3, self).__init__()\n\n        self.resize_input = resize_input\n        self.normalize_input = normalize_input\n        self.output_blocks = sorted(output_blocks)\n        self.last_needed_block = max(output_blocks)\n\n        assert self.last_needed_block <= 3, 'Last possible output block index is 3'\n\n        self.blocks = nn.ModuleList()\n\n        if use_fid_inception:\n            inception = fid_inception_v3()\n        else:\n            inception = _inception_v3(weights='DEFAULT')\n\n        block0 = [\n            inception.Conv2d_1a_3x3,\n            inception.Conv2d_2a_3x3,\n            inception.Conv2d_2b_3x3,\n            nn.MaxPool2d(kernel_size=3, stride=2)\n        ]\n        self.blocks.append(nn.Sequential(*block0))\n\n        if self.last_needed_block >= 1:\n            block1 = [\n                inception.Conv2d_3b_1x1,\n                inception.Conv2d_4a_3x3,\n                nn.MaxPool2d(kernel_size=3, stride=2)\n            ]\n            self.blocks.append(nn.Sequential(*block1))\n\n        if self.last_needed_block >= 2:\n            block2 = [\n                inception.Mixed_5b,\n                inception.Mixed_5c,\n                inception.Mixed_5d,\n                inception.Mixed_6a,\n                inception.Mixed_6b,\n                inception.Mixed_6c,\n                inception.Mixed_6d,\n                inception.Mixed_6e,\n            ]\n            self.blocks.append(nn.Sequential(*block2))\n\n        if self.last_needed_block >= 3:\n            block3 = [\n                inception.Mixed_7a,\n                inception.Mixed_7b,\n                inception.Mixed_7c,\n                nn.AdaptiveAvgPool2d(output_size=(1, 1))\n            ]\n            self.blocks.append(nn.Sequential(*block3))\n\n        for param in self.parameters():\n            param.requires_grad = requires_grad\n\n    def forward(self, inp):\n        outp = []\n        x = inp\n\n        if self.resize_input:\n            x = F.interpolate(x,\n                              size=(299, 299),\n                              mode='bilinear',\n                              align_corners=False)\n\n        if self.normalize_input:\n            x = 2 * x - 1\n\n        for idx, block in enumerate(self.blocks):\n            x = block(x)\n            if idx in self.output_blocks:\n                outp.append(x)\n\n            if idx == self.last_needed_block:\n                break\n\n        return outp\n\n\ndef _inception_v3(*args, **kwargs):\n    try:\n        version = tuple(map(int, torchvision.__version__.split('.')[:2]))\n    except ValueError:\n        version = (0,)\n\n    if version >= (0, 6):\n        kwargs['init_weights'] = False\n\n    if version < (0, 13) and 'weights' in kwargs:\n        if kwargs['weights'] == 'DEFAULT':\n            kwargs['pretrained'] = True\n        elif kwargs['weights'] is None:\n            kwargs['pretrained'] = False\n        else:\n            raise ValueError(\n                'weights=={} not supported in torchvision {}'.format(\n                    kwargs['weights'], torchvision.__version__\n                )\n            )\n        del kwargs['weights']\n\n    return torchvision.models.inception_v3(*args, **kwargs)\n\n\ndef fid_inception_v3():\n    inception = _inception_v3(num_classes=1008, aux_logits=False, weights=None)\n    inception.Mixed_5b = FIDInceptionA(192, pool_features=32)\n    inception.Mixed_5c = FIDInceptionA(256, pool_features=64)\n    inception.Mixed_5d = FIDInceptionA(288, pool_features=64)\n    inception.Mixed_6b = FIDInceptionC(768, channels_7x7=128)\n    inception.Mixed_6c = FIDInceptionC(768, channels_7x7=160)\n    inception.Mixed_6d = FIDInceptionC(768, channels_7x7=160)\n    inception.Mixed_6e = FIDInceptionC(768, channels_7x7=192)\n    inception.Mixed_7b = FIDInceptionE_1(1280)\n    inception.Mixed_7c = FIDInceptionE_2(2048)\n\n    state_dict = load_state_dict_from_url(FID_WEIGHTS_URL, progress=True)\n    inception.load_state_dict(state_dict)\n    return inception\n\n\nclass FIDInceptionA(torchvision.models.inception.InceptionA):\n    def __init__(self, in_channels, pool_features):\n        super(FIDInceptionA, self).__init__(in_channels, pool_features)\n\n    def forward(self, x):\n        branch1x1 = self.branch1x1(x)\n        branch5x5 = self.branch5x5_1(x)\n        branch5x5 = self.branch5x5_2(branch5x5)\n        branch3x3dbl = self.branch3x3dbl_1(x)\n        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)\n        branch3x3dbl = self.branch3x3dbl_3(branch3x3dbl)\n        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)\n        branch_pool = self.branch_pool(branch_pool)\n        outputs = [branch1x1, branch5x5, branch3x3dbl, branch_pool]\n        return torch.cat(outputs, 1)\n\n\nclass FIDInceptionC(torchvision.models.inception.InceptionC):\n    def __init__(self, in_channels, channels_7x7):\n        super(FIDInceptionC, self).__init__(in_channels, channels_7x7)\n\n    def forward(self, x):\n        branch1x1 = self.branch1x1(x)\n        branch7x7 = self.branch7x7_1(x)\n        branch7x7 = self.branch7x7_2(branch7x7)\n        branch7x7 = self.branch7x7_3(branch7x7)\n        branch7x7dbl = self.branch7x7dbl_1(x)\n        branch7x7dbl = self.branch7x7dbl_2(branch7x7dbl)\n        branch7x7dbl = self.branch7x7dbl_3(branch7x7dbl)\n        branch7x7dbl = self.branch7x7dbl_4(branch7x7dbl)\n        branch7x7dbl = self.branch7x7dbl_5(branch7x7dbl)\n        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)\n        branch_pool = self.branch_pool(branch_pool)\n        outputs = [branch1x1, branch7x7, branch7x7dbl, branch_pool]\n        return torch.cat(outputs, 1)\n\n\nclass FIDInceptionE_1(torchvision.models.inception.InceptionE):\n    def __init__(self, in_channels):\n        super(FIDInceptionE_1, self).__init__(in_channels)\n\n    def forward(self, x):\n        branch1x1 = self.branch1x1(x)\n        branch3x3 = self.branch3x3_1(x)\n        branch3x3 = [self.branch3x3_2a(branch3x3), self.branch3x3_2b(branch3x3)]\n        branch3x3 = torch.cat(branch3x3, 1)\n        branch3x3dbl = self.branch3x3dbl_1(x)\n        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)\n        branch3x3dbl = [self.branch3x3dbl_3a(branch3x3dbl), self.branch3x3dbl_3b(branch3x3dbl)]\n        branch3x3dbl = torch.cat(branch3x3dbl, 1)\n        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)\n        branch_pool = self.branch_pool(branch_pool)\n        outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]\n        return torch.cat(outputs, 1)\n\n\nclass FIDInceptionE_2(torchvision.models.inception.InceptionE):\n    def __init__(self, in_channels):\n        super(FIDInceptionE_2, self).__init__(in_channels)\n\n    def forward(self, x):\n        branch1x1 = self.branch1x1(x)\n\n        branch3x3 = self.branch3x3_1(x)\n        branch3x3 = [\n            self.branch3x3_2a(branch3x3),\n            self.branch3x3_2b(branch3x3),\n        ]\n        branch3x3 = torch.cat(branch3x3, 1)\n\n        branch3x3dbl = self.branch3x3dbl_1(x)\n        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)\n        branch3x3dbl = [\n            self.branch3x3dbl_3a(branch3x3dbl),\n            self.branch3x3dbl_3b(branch3x3dbl),\n        ]\n        branch3x3dbl = torch.cat(branch3x3dbl, 1)\n\n        branch_pool = F.max_pool2d(x, kernel_size=3, stride=1, padding=1)\n        branch_pool = self.branch_pool(branch_pool)\n\n        outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]\n        return torch.cat(outputs, 1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\"\"\"Calculates the Frechet Inception Distance (FID) to evalulate GANs\n\nThe FID metric calculates the distance between two distributions of images.\nTypically, we have summary statistics (mean & covariance matrix) of one\nof these distributions, while the 2nd distribution is given by a GAN.\n\nWhen run as a stand-alone program, it compares the distribution of\nimages that are stored as PNG/JPEG at a specified location with a\ndistribution given by summary statistics (in pickle format).\n\nThe FID is calculated by assuming that X_1 and X_2 are the activations of\nthe pool_3 layer of the inception net for generated samples and real world\nsamples respectively.\n\nSee --help to see further details.\n\nCode apapted from https://github.com/bioinf-jku/TTUR to use PyTorch instead\nof Tensorflow\n\nCopyright 2018 Institute of Bioinformatics, JKU Linz\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\"\"\"\nimport os\nimport pathlib\nfrom argparse import ArgumentDefaultsHelpFormatter, ArgumentParser\n\nimport numpy as np\nimport torch\nimport torchvision.transforms as TF\nfrom PIL import Image\nfrom scipy import linalg\nfrom torch.nn.functional import adaptive_avg_pool2d\n\ntry:\n    from tqdm import tqdm\nexcept ImportError:\n    # If tqdm is not available, provide a mock version of it\n    def tqdm(x):\n        return x\n\nfrom pytorch_fid.inception import InceptionV3\n\nparser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)\nparser.add_argument('--batch-size', type=int, default=50,\n                    help='Batch size to use')\nparser.add_argument('--num-workers', type=int,\n                    help=('Number of processes to use for data loading. '\n                          'Defaults to `min(8, num_cpus)`'))\nparser.add_argument('--device', type=str, default=None,\n                    help='Device to use. Like cuda, cuda:0 or cpu')\nparser.add_argument('--dims', type=int, default=2048,\n                    choices=list(InceptionV3.BLOCK_INDEX_BY_DIM),\n                    help=('Dimensionality of Inception features to use. '\n                          'By default, uses pool3 features'))\nparser.add_argument('--save-stats', action='store_true',\n                    help=('Generate an npz archive from a directory of samples. '\n                          'The first path is used as input and the second as output.'))\nparser.add_argument('path', type=str, nargs=2,\n                    help=('Paths to the generated images or '\n                          'to .npz statistic files'))\n\nIMAGE_EXTENSIONS = {'bmp', 'jpg', 'jpeg', 'pgm', 'png', 'ppm',\n                    'tif', 'tiff', 'webp'}\n\n\nclass ImagePathDataset(torch.utils.data.Dataset):\n    def __init__(self, files, transforms=None):\n        self.files = files\n        self.transforms = transforms\n\n    def __len__(self):\n        return len(self.files)\n\n    def __getitem__(self, i):\n        image_path = self.files[i]\n        image_data = None\n        with tf.io.gfile.GFile(image_path, 'rb') as f:\n            image_data = f.read()\n        image_tensor = tf.image.decode_jpeg(image_data, channels=3)\n        image_np = image_tensor.numpy()\n        img = Image.fromarray(image_np)\n        if self.transforms is not None:\n            img = self.transforms(img)\n        return img\n\n\ndef get_activations(files, model, batch_size=50, dims=2048, device='cpu',\n                    num_workers=1):\n    \"\"\"Calculates the activations of the pool_3 layer for all images.\n\n    Params:\n    -- files       : List of image files paths\n    -- model       : Instance of inception model\n    -- batch_size  : Batch size of images for the model to process at once.\n                     Make sure that the number of samples is a multiple of\n                     the batch size, otherwise some samples are ignored. This\n                     behavior is retained to match the original FID score\n                     implementation.\n    -- dims        : Dimensionality of features returned by Inception\n    -- device      : Device to run calculations\n    -- num_workers : Number of parallel dataloader workers\n\n    Returns:\n    -- A numpy array of dimension (num images, dims) that contains the\n       activations of the given tensor when feeding inception with the\n       query tensor.\n    \"\"\"\n    model.eval()\n\n    if batch_size > len(files):\n        print(('Warning: batch size is bigger than the data size. '\n               'Setting batch size to data size'))\n        batch_size = len(files)\n\n    dataset = ImagePathDataset(files, transforms=TF.ToTensor())\n    dataloader = torch.utils.data.DataLoader(dataset,\n                                             batch_size=batch_size,\n                                             shuffle=False,\n                                             drop_last=False,\n                                             num_workers=1)\n   # data = train_iterator.dataset.data \n#shape = train_iterator.dataset.data.shape  \n#datatype = train_iterator.dataset.data.dtype\n    print(dataloader.dataset.__len__)\n\n    pred_arr = np.empty((len(files), dims))\n\n    start_idx = 0\n\n    for batch in tqdm(dataloader):\n        batch = batch.to(device)\n\n        with torch.no_grad():\n            pred = model(batch)[0]\n\n        # If model output is not scalar, apply global spatial average pooling.\n        # This happens if you choose a dimensionality not equal 2048.\n        if pred.size(2) != 1 or pred.size(3) != 1:\n            pred = adaptive_avg_pool2d(pred, output_size=(1, 1))\n\n        pred = pred.squeeze(3).squeeze(2).cpu().numpy()\n\n        pred_arr[start_idx:start_idx + pred.shape[0]] = pred\n\n        start_idx = start_idx + pred.shape[0]\n\n    return pred_arr\n\n\ndef calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):\n    \"\"\"Numpy implementation of the Frechet Distance.\n    The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1)\n    and X_2 ~ N(mu_2, C_2) is\n            d^2 = ||mu_1 - mu_2||^2 + Tr(C_1 + C_2 - 2*sqrt(C_1*C_2)).\n\n    Stable version by Dougal J. Sutherland.\n\n    Params:\n    -- mu1   : Numpy array containing the activations of a layer of the\n               inception net (like returned by the function 'get_predictions')\n               for generated samples.\n    -- mu2   : The sample mean over activations, precalculated on an\n               representative data set.\n    -- sigma1: The covariance matrix over activations for generated samples.\n    -- sigma2: The covariance matrix over activations, precalculated on an\n               representative data set.\n\n    Returns:\n    --   : The Frechet Distance.\n    \"\"\"\n\n    mu1 = np.atleast_1d(mu1)\n    mu2 = np.atleast_1d(mu2)\n\n    sigma1 = np.atleast_2d(sigma1)\n    sigma2 = np.atleast_2d(sigma2)\n\n    assert mu1.shape == mu2.shape, \\\n        'Training and test mean vectors have different lengths'\n    assert sigma1.shape == sigma2.shape, \\\n        'Training and test covariances have different dimensions'\n\n    diff = mu1 - mu2\n\n    # Product might be almost singular\n    covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)\n    if not np.isfinite(covmean).all():\n        msg = ('fid calculation produces singular product; '\n               'adding %s to diagonal of cov estimates') % eps\n        print(msg)\n        offset = np.eye(sigma1.shape[0]) * eps\n        covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset))\n\n    # Numerical error might give slight imaginary component\n    if np.iscomplexobj(covmean):\n        if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):\n            m = np.max(np.abs(covmean.imag))\n            raise ValueError('Imaginary component {}'.format(m))\n        covmean = covmean.real\n\n    tr_covmean = np.trace(covmean)\n\n    return (diff.dot(diff) + np.trace(sigma1)\n            + np.trace(sigma2) - 2 * tr_covmean)\n\n\ndef calculate_activation_statistics(files, model, batch_size=50, dims=2048,\n                                    device='cpu', num_workers=1):\n    \"\"\"Calculation of the statistics used by the FID.\n    Params:\n    -- files       : List of image files paths\n    -- model       : Instance of inception model\n    -- batch_size  : The images numpy array is split into batches with\n                     batch size batch_size. A reasonable batch size\n                     depends on the hardware.\n    -- dims        : Dimensionality of features returned by Inception\n    -- device      : Device to run calculations\n    -- num_workers : Number of parallel dataloader workers\n\n    Returns:\n    -- mu    : The mean over samples of the activations of the pool_3 layer of\n               the inception model.\n    -- sigma : The covariance matrix of the activations of the pool_3 layer of\n               the inception model.\n    \"\"\"\n    act = get_activations(files, model, batch_size, dims, device, num_workers)\n    mu = np.mean(act, axis=0)\n    sigma = np.cov(act, rowvar=False)\n    return mu, sigma\n\n\ndef compute_statistics_of_painting_path(path, model, batch_size, dims, device,\n                               num_workers=1):\n    if path.endswith('.npz'):\n        with np.load(path) as f:\n            m, s = f['mu'][:], f['sigma'][:]\n    else:\n        #path = pathlib.Path(path)\n        files = []\n        for file in tf.io.gfile.glob(f'{path}/*.jpg'):\n            files.append(file)\n        files = sorted(files)\n        m, s = calculate_activation_statistics(files, model, batch_size,\n                                               dims, device, num_workers)\n\n    return m, s\n\ndef compute_statistics_of_transformed_path(path, model, batch_size, dims, device,\n                               num_workers=1):\n    if path.endswith('.npz'):\n        with np.load(path) as f:\n            m, s = f['mu'][:], f['sigma'][:]\n    else:\n        #path = pathlib.Path(path)\n        files = []\n        for file in tf.io.gfile.glob(f'{path}/*.jpg'):\n            files.append(file)\n        files = sorted(files)\n        m, s = calculate_activation_statistics(files, model, batch_size,\n                                               dims, device, num_workers)\n\n    return m, s\n\n\ndef calculate_fid_given_paths(paths, batch_size, device, dims, num_workers=1):\n    \"\"\"Calculates the FID of two paths\"\"\"\n    for p in paths:\n        if not tf.io.gfile.exists(p):\n            raise RuntimeError('Invalid path: %s' % p)\n\n    block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims]\n\n    model = InceptionV3([block_idx]).to(device)\n\n    m1, s1 = compute_statistics_of_painting_path(paths[0], model, batch_size,\n                                        dims, device, num_workers)\n    m2, s2 = compute_statistics_of_transformed_path(paths[1], model, batch_size,\n                                        dims, device, num_workers)\n    fid_value = calculate_frechet_distance(m1, s1, m2, s2)\n\n    return fid_value\n\n\ndef save_fid_stats(paths, batch_size, device, dims, num_workers=1):\n    \"\"\"Calculates the FID of two paths\"\"\"\n    if not tf.io.gfile.exists(paths[0]):\n        raise RuntimeError('Invalid path: %s' % paths[0])\n\n    if tf.io.gfile.exists(paths[1]):\n        raise RuntimeError('Existing output file: %s' % paths[1])\n\n    block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims]\n\n    model = InceptionV3([block_idx]).to(device)\n\n    print(f\"Saving statistics for {paths[0]}\")\n\n    m1, s1 = compute_statistics_of_path(paths[0], model, batch_size,\n                                        dims, device, num_workers)\n\n    np.savez_compressed(paths[1], mu=m1, sigma=s1)\n\n\ndef main():\n    args = parser.parse_args()\n\n    if args.device is None:\n        device = torch.device('cuda' if (torch.cuda.is_available()) else 'cpu')\n    else:\n        device = torch.device(args.device)\n\n    if args.num_workers is None:\n        try:\n            num_cpus = len(os.sched_getaffinity(0))\n        except AttributeError:\n            # os.sched_getaffinity is not available under Windows, use\n            # os.cpu_count instead (which may not return the *available* number\n            # of CPUs).\n            num_cpus = os.cpu_count()\n\n        num_workers = min(num_cpus, 8) if num_cpus is not None else 0\n    else:\n        num_workers = args.num_workers\n\n    if args.save_stats:\n        save_fid_stats(args.path, args.batch_size, device, args.dims, num_workers)\n        return\n\n    fid_value = calculate_fid_given_paths(args.path,\n                                          args.batch_size,\n                                          device,\n                                          args.dims,\n                                          num_workers)\n    print('FID: ', fid_value)\n\n\n#if __name__ == '__main__':\n#    main()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from kaggle_datasets import KaggleDatasets\nimport os\n\ndef generate_fid_value(epoch):\n    DATASET_PATH = KaggleDatasets().get_gcs_path('ukiyoe-painting-test-for-fid')\n    RESULTS_PATH = KaggleDatasets().get_gcs_path('ukiyoe-'+epoch+'-epochs')\n    PAINTING_DIR = f'{DATASET_PATH}/testA'\n    TRANSFORMED_PHOTOS_DIR = f'{RESULTS_PATH}/images_ukiyoe_'+epoch+'/jpg'\n    PATHS = [PAINTING_DIR, TRANSFORMED_PHOTOS_DIR]\n    print(PAINTING_DIR)\n    BATCH_SIZE = 50\n    DEVICE = None\n    DIMS = 2048\n    NUM_WORKERS = 1\n    fid_value = calculate_fid_given_paths(PATHS, BATCH_SIZE, DEVICE, DIMS, NUM_WORKERS)\n    print(fid_value)\n    print(epoch)\n","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('10')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('20')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('30')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('40')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('50')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('60')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('70')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('80')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('90')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('100')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('110')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('120')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#generate_fid_value('130')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"generate_fid_value('135')","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}