{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Move File" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Used to copy random 5k image from 10k image source" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import shutil\n", "import random" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [], "source": [ "num = 5000\n", "source = 'mnist_images_fid'\n", "destination = 'mnist_images_is'" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [], "source": [ "folders_root_dir = os.listdir(source)" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [], "source": [ "index = np.random.choice(a=len(folders_root_dir),\n", " size=num,\n", " replace=False)" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [], "source": [ "for i in index:\n", " file = folders_root_dir[i]\n", " shutil.copyfile(os.path.join(source, file), os.path.join(destination, file))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Inception Score (5k)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "inception_score_mean: 2.142887\n", "inception_score_std: 0.04756409\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Creating feature extractor \"inception-v3-compat\" with features ['logits_unbiased']\n", "Extracting features from input1\n", "Looking for samples non-recursivelty in \"resnet/sample_is\" with extensions png,jpg,jpeg\n", "Found 5000 samples\n", "D:\\Anaconda\\lib\\site-packages\\torch_fidelity\\datasets.py:16: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n", " img = torch.ByteTensor(torch.ByteStorage.from_buffer(img.tobytes())).view(height, width, 3)\n", "\n", "Processing samples: 0%| | 0/5000 [00:00