Created
February 9, 2020 21:23
-
-
Save ivanlen/e7662d53420f84778c92b77fdc5a4786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from PIL import Image\n", | |
| "import matplotlib.pyplot as plt\n", | |
| "import os\n", | |
| "import numpy as np\n", | |
| "import sys" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# folder_to_scan = './results/00001-sgan-ffhq-mars-1gpu/'\n", | |
| "folder_to_scan = './results/00002-sgan-ffhq-mars-1gpu/'" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "files = os.listdir(folder_to_scan)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "valid_file_types = ['.png']\n", | |
| "valid_files = []\n", | |
| "for file in files:\n", | |
| " f, fe = os.path.splitext(file)\n", | |
| " if fe in valid_file_types:\n", | |
| " valid_files.append(file)\n", | |
| "\n", | |
| "full_path_valid_files = [folder_to_scan+file for file in valid_files]\n", | |
| "fakes = [ff for ff in full_path_valid_files if 'fake' in ff]" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "fakes.sort()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "im = Image.open(fakes[-1])" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment