本文整理汇总了Python中rbm.RBM.contrast_divergence方法的典型用法代码示例。如果您正苦于以下问题:Python RBM.contrast_divergence方法的具体用法?Python RBM.contrast_divergence怎么用?Python RBM.contrast_divergence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rbm.RBM
的用法示例。
在下文中一共展示了RBM.contrast_divergence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CNN
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import contrast_divergence [as 别名]
cnn2 = CNN(cnn1.output(), filter_shape, filter_shift_list[1], node_shape[1], node_shape[2], pre_train_lr, pre_train_epoch)
output_list = cnn2.output()
saveImage(output_list, node_shape[2], 'cnn2_before_train')
cnn2.pre_train()
output_list = cnn2.output()
saveImage(output_list, node_shape[2], 'cnn2_after_train')
rbm_size_list = (680, 340, 170, 85, 42, 21, 10, 3)
# def __init__(self, W, input, data_size,input_size, output_size, isDropout):
rbm1 = RBM(None, cnn2.output(), file_num, rbm_size_list[0], rbm_size_list[1], False)
for i in xrange(pre_train_epoch):
print 'rbm1 pre_train:' + str(i)
rbm1.contrast_divergence()
reinput = rbm1.reconstruct_from_input(rbm1.input)
saveImage(reinput, node_shape[2], 'rbm1_after_train')
saveW(rbm1.getW(), 'rbm1_after_train')
rbm2 = RBM(None, rbm1.output(), file_num, rbm_size_list[1], rbm_size_list[2], False)
for i in xrange(pre_train_epoch):
print 'rbm2 pre_train:' + str(i)
rbm2.contrast_divergence()
reinput = rbm2.reconstruct_from_input(rbm2.input)
reinput = rbm1.reconstruct_from_output(reinput)
saveImage(reinput, node_shape[2], 'rbm2_after_train')
saveW(rbm2.getW(), 'rbm2_after_train')
rbm3 = RBM(None, rbm2.output(), file_num, rbm_size_list[2], rbm_size_list[3], False)
for i in xrange(pre_train_epoch):
示例2: load_result_image
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import contrast_divergence [as 别名]
# rbm_size_list = (468, 234, 117, 58, 29, 14, 7, 7)
rbm_size_list = (468, 234, 117, 58, 30, 14, 7, 7)
result_path = 'data/kouryu_room/cnn2_after_training'
result_data = load_result_image(result_path, file_num, isRGB)
# result_path = 'data/4position_rumba/image7000/rbm1_train3434'
# result_W = loadW(result_path)
makeFolder()
# def __init__(self, W, input, data_size,input_size, output_size, isDropout):
rbm1 = RBM(None, result_data, file_num, rbm_size_list[0], rbm_size_list[1])
for i in xrange(pre_train_epoch):
print 'rbm1 pre_train:' + str(i)
rbm1.contrast_divergence(i)
reinput = rbm1.reconstruct_from_input(rbm1.input)
saveImage(reinput, node_shape[2], 'rbm1_after_train')
saveW(rbm1.getW(), 'rbm1_after_train')
rbm2 = RBM(None, rbm1.output(), file_num, rbm_size_list[1], rbm_size_list[2])
for i in xrange(pre_train_epoch):
print 'rbm2 pre_train:' + str(i)
rbm2.contrast_divergence(i)
reinput = rbm2.reconstruct_from_input(rbm2.input)
reinput = rbm1.reconstruct_from_output(reinput)
saveImage(reinput, node_shape[2], 'rbm2_after_train')
saveW(rbm2.getW(), 'rbm2_after_train')
rbm3 = RBM(None, rbm2.output(), file_num, rbm_size_list[2], rbm_size_list[3])
for i in xrange(pre_train_epoch):