Skip to content

Instantly share code, notes, and snippets.

View Timmate's full-sized avatar

Timofei Kornev Timmate

View GitHub Profile
import tensorflow as tf
import numpy as np
import PIL
from PIL import Image
import os
from scipy.io import loadmat, savemat
from preprocess_img import Preprocess
from load_data import *
from face_decoder import Face3D
import logging
# w/o below lines with reloading `logging` no log file will be saved in Jupyter/IPython env, see here: https://stackoverflow.com/questions/31169540/python-logging-not-saving-to-file
from imp import reload
reload(logging)
from contextlib import redirect_stdout, redirect_stderr
LOG_FILE_NAME = 'log.txt'
# from https://stackoverflow.com/a/36296215
class StreamToLogger(object):