Skip to content

Instantly share code, notes, and snippets.

@ivanlen
Created February 9, 2020 21:23
Show Gist options
  • Select an option

  • Save ivanlen/e7662d53420f84778c92b77fdc5a4786 to your computer and use it in GitHub Desktop.

Select an option

Save ivanlen/e7662d53420f84778c92b77fdc5a4786 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"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