Пример #1
0
from PIL import Image as PILImage
#	Utilities
from tqdm import tqdm
import time
import psutil
from datetime import datetime
# =================================================================================================================
# Custom packages
user_dir = os.path.expanduser('~')
script_dir = Path((__file__)).parents[0]
project_dir = os.path.abspath(Path((__file__)).parents[1])
sys.path.append(project_dir)
import utils_dir.utils as utils
from utils_dir.utils import timeit, get_varargin, ProgressBar
from utils_dir import logger_utils as logger_utils
logger = logger_utils.htmlLogger(log_file = './{}_{}.html'\
    .format(datetime.now().strftime('%y%m%d'), os.path.basename(__file__)), mode = 'w')
logger.info('START -- project dir: {}'.format(project_dir))
# =================================================================================================================
# DEFINES
(X_train, y_train), (X_test, y_test) = kerasDatasets.mnist.load_data()
BUFFER_SIZE = 10000
BATCH_SIZE = 256
IMG_SIZE = (X_train.shape[1], X_train.shape[2])
TRAIN_SIZE = X_train.shape[0]
NB_EPOCHS = 100
NB_BATCHS = int(TRAIN_SIZE/BATCH_SIZE)
NB_CLASSES = 10
# =================================================================================================================
# Functions
def load_dataset(X_train, y_train, X_test, y_test, **kwargs):
    # Load Data
Пример #2
0
import time
from datetime import datetime
import logging
# =================================================================================================================
# Custom packages
user_dir = os.path.expanduser('~')
project_dir = os.path.join(user_dir, 'serviceBot')
if not (project_dir in sys.path):
    print('sys.append: {}'.format(project_dir))
    sys.path.append(project_dir)
from utils_dir.utils import timeit, get_varargin, verbose
import utils_dir.utils as utils
from utils_dir import logger_utils as logger_utils
from icons.iconClass import iconClass
pyIcons = iconClass(icon_dir=os.path.join(project_dir, 'icons'))
logger = logger_utils.htmlLogger(log_file = os.path.join(project_dir, '{}_GUIlogging.html'\
    .format(datetime.now().strftime('%y%m%d'))), mode = 'w')
logger.info('START -- project dir: {}'.format(project_dir))


# =================================================================================================================
# FUNCTIONS
# Decorator
def log_info(func):
    @functools.wraps(func)
    def inner(*args, **kwargs):
        logger.info('START: {}'.format(func.__name__))
        try:
            result = func(*args, **kwargs)
        except Exception as e:
            logger.error(e)
            return None
Пример #3
0
import numpy as np
import random

from tqdm import tqdm
# Visualization
import matplotlib.pyplot as plt
# Custom packages
user_dir = os.path.expanduser('~')
project_dir = os.path.join(user_dir, 'serviceBot')
sys.path.append(project_dir)
import utils_dir.utils as utils
from utils_dir.utils import timeit, get_varargin, ProgressBar
from utils_dir import logger_utils as logger_utils
from model import resnet as resnet_utils
import config.baseConfig as baseConfig
logger = logger_utils.htmlLogger(log_file='./191214_gan_logging.html',
                                 mode='w')
logger.info('START -- project dir: {}'.format(project_dir))
logger.nvidia_smi()

# Dataset of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images.
(X_train, Y_train), (X_test, Y_test) = kerasDatasets.mnist.load_data()
# Preprocessing
# X_train = X_train.reshape(60000, 784)
# X_test = X_test.reshape(10000, 784)
# X_train = X_train.astype('float32')/255
# X_test = X_test.astype('float32')/255
BUFFER_SIZE = 10000
BATCH_SIZE = 128 * 3

train_images = X_train
train_images = train_images.reshape(train_images.shape[0], 28, 28,