# coding: utf-8

# ### Generating human faces with Adversarial Networks
import sys
sys.path.append("..")
import helpers
helpers.mask_busy_gpus(wait=False)

import numpy as np
#Those attributes will be required for the final part of the assignment (applying smiles), so please keep them in mind
#from lfw_dataset2 import load_lfw_dataset
from lfw_dataset import load_lfw_dataset
data, attrs = load_lfw_dataset(dimx=36, dimy=36)
#data = load_lfw_dataset(use_raw=True,dimx=36,dimy=36)
#print(np.max(data),np.min(data))
#preprocess faces
#data = np.float32(data)
#print(data[0])
data = (data - 127.5) / float(127.5)  #scale to between -1 and 1

#print(data[0])
IMG_SHAPE = data.shape[1:]

# In[3]:

#print random image
print(data.shape)

import tensorflow as tf
gpu_options = tf.GPUOptions(allow_growth=True,
                            per_process_gpu_memory_fraction=0.333)
示例#2
0
    ax.legend(loc='upper left')

    plt.text(0.5,
             1.08,
             figure_title,
             horizontalalignment='center',
             fontsize=15,
             transform=ax.transAxes)

    my_fig.savefig(plot_dir + '/loss_as_metric/' + save_name + "_" +
                   train_test + ".png")


if __name__ == "__main__":

    helper_functions.mask_busy_gpus(leave_unmasked=1)

    basedir = os.environ['BASEDIR']

    trained_model = models.load_model(basedir + "/models/" + args.model_name +
                                      '_' + args.loss_name + '_' +
                                      args.opt_name + '.h5')  #load model

    image_type = os.environ['EB_OCC']

    try:  #get the data
        data_folder = os.environ["DATA"]
    except KeyError:
        "Please cd into the module's base folder and run set_env from there."

    file_list = os.listdir(data_folder)
# coding: utf-8

# # LHC Machine Learing workshop challenge
# https://gitlab.cern.ch/IML-WG/IML_challenge_2018/wikis/home
#
# Task: Regress the soft-drop mass of jets with high transverse momentum

# In[1]:

#get the data
import numpy as np
import helpers
helpers.mask_busy_gpus()

my_array = np.load('../data/qcd.npy', encoding='bytes')

my_rec_array = my_array.view(np.recarray)

# In[3]:

fields = my_array.dtype.names

# In[5]:

#del my_train_val_array
num_jets = my_rec_array.shape[0]
for field in fields:
    print(field)
    x = getattr(my_rec_array, field)
    x = np.reshape(x, [1, num_jets])
    try: