Ejemplo n.º 1
0
#tb_profile = tf.keras.callbacks.TensorBoard(log_dir = "E:\workspace_ms_zhiyuan\\tensorboard_log\\",histogram_freq = 1, profile_batch = '500,520')
#tf.keras.backend.floatx()

#os.environ['AUTOGRAPH_VERBOSITY'] = 5
model = SVBRDF_debugged(9)
#model = svbrdf_branched()
learning_rate = 0.00002
#model = UNET(9)
#model.summary()

sample = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\Train_smaller'
train_path = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\trainBlended'
test_path = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\testBlended'
#test_path = 'D:\Y4\DNNreimplement\Deschaintre\Dataset\Train'
print('load_data')
ds = svbrdf_gen(train_path, 8)
sample_ds = svbrdf_gen(sample, 8)
test_ds = svbrdf_gen(test_path, 8)
print(ds.element_spec)
print('finish_loading')

opt = Adam(lr=learning_rate)
model.compile(optimizer=opt, loss=rendering_loss, metrics=['accuracy'])
hitory = model.fit(
    ds,
    verbose=1,
    steps_per_epoch=20,
    epochs=8,
    callbacks=[
        tensorboard_callback
    ])  #24884 DisplayCallback(),tensorboard_callback,DisplayCallback(),
Ejemplo n.º 2
0
import tensorflow as tf
from svbrdf import SVBRDF
from DataGen import svbrdf_gen
from GGXrenderer import rendering_loss,l1_loss
from tensorflow.keras.optimizers import Adam 

print(tf.__version__)

test_path =  'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\testBlended'
print('load_data')
ds = svbrdf_gen(test_path,8)
print(ds.element_spec)
print('finish_loading')


opt = Adam(lr=0.00002)
new_model = tf.keras.models.load_model('E:\workspace_ms_zhiyuan\DNNreimplement\Model_trained\Model_trained\Model_fully_functional', custom_objects = {'rendering_loss' : rendering_loss},compile=False )
#new_model.summary()
new_model.compile(optimizer = opt, loss = rendering_loss, metrics = ['accuracy'])
loss, acc = new_model.evaluate(ds, verbose=2,steps=10)

print('Restored model, accuracy: {:5.2f}%'.format(100 * acc))
Ejemplo n.º 3
0
        display(photo[0],pred_svbrdf[0])
        


#tf.keras.backend.floatx()
#os.environ['AUTOGRAPH_VERBOSITY'] = 5
model = SVBRDF(9)
#model = UNET(9)
#model.summary()

sample = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\Train_smaller'
train_path = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\trainBlended'
#test_path =  'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\testBlended'
#test_path = 'D:\Y4\DNNreimplement\Deschaintre\Dataset\Train'
print('load_data')
ds = svbrdf_gen(sample,8)
sample_ds = svbrdf_gen(sample,8)
print(ds.element_spec)
print('finish_loading')


opt = Adam(lr=0.00002)
model.compile(optimizer = opt, loss = rendering_loss, metrics = ['mse'])
hitory = model.fit( ds,verbose =1 , steps_per_epoch = 20, epochs=20)#,callbacks=[DisplayCallback()]) #24884

plt.plot(list(range(0, num_epochs)), hitory.history['loss'], label=' Loss',c='r',alpha=0.6)
plt.plot(list(range(0, num_epochs)), hitory.history['mse'], label=' mse',c='b',alpha=0.6)

model.save('E:\workspace_ms_zhiyuan\DNNreimplement\Model_saved_1')
plt.show()
Ejemplo n.º 4
0
import tensorflow as tf
from svbrdf import SVBRDF, rendering_loss
from DataGen import svbrdf_gen
#from ds_test.ds_test import DsTest
tf.keras.backend.floatx()
model = SVBRDF(9)
#model.summary()

#train_path = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\trainBlended'
#test_path =  'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\testBlended'
#(trainx, trainy),(testx,testy) = DsTest.load()


train_path = 'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\trainBlended'
test_path =  'E:\workspace_ms_zhiyuan\Data_Deschaintre18\\testBlended'
print('load_data')
ds = svbrdf_gen(train_path,8)
print(ds.element_spec)
print('finish_loading')
model.compile(optimizer = 'Adam', loss = rendering_loss, metrics = ['mse'])
model.fit( ds,verbose =2 , epochs=20)
model.save('E:\workspace_ms_zhiyuan\DNNreimplement\Deschaintre\Model_saved')