1 Star 0 Fork 0

zhoub86/BPCNN

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 2.47 KB
一键复制 编辑 原始数据 按行查看 历史
Julie.C 提交于 2018-07-10 14:15 . [refactor] Add finish message
# #################################################################
# Python code to reproduce our works on iterative BP-CNN.
#
# Codes have been tested successfully on Python 3.4.5 with TensorFlow 1.1.0.
#
# References:
# Fei Liang, Cong Shen and Feng Wu, "An Iterative BP-CNN Architecture for Channel Decoding under Correlated Noise", IEEE JSTSP
#
# Written by Fei Liang (lfbeyond@mail.ustc.edu.cn, liang.fei@outlook.com)
# #################################################################
import sys
import Configrations
import numpy as np
import LinearBlkCodes as lbc
import Iterative_BP_CNN as ibd
import ConvNet
import DataIO
# address configurations
top_config = Configrations.TopConfig()
top_config.parse_cmd_line(sys.argv)
train_config = Configrations.TrainingConfig(top_config)
net_config = Configrations.NetConfig(top_config)
code = lbc.LDPC(top_config.N_code, top_config.K_code, top_config.file_G, top_config.file_H)
if top_config.function == 'GenData':
noise_io = DataIO.NoiseIO(top_config.N_code, False, None, top_config.cov_1_2_file)
# generate training data
ibd.generate_noise_samples(code, top_config, net_config, train_config, top_config.BP_iter_nums_gen_data,
top_config.currently_trained_net_id, 'Training', noise_io, top_config.model_id)
# generate test data
ibd.generate_noise_samples(code, top_config, net_config, train_config, top_config.BP_iter_nums_gen_data,
top_config.currently_trained_net_id, 'Test', noise_io, top_config.model_id)
print("Finished GenData!")
elif top_config.function == 'Train':
net_id = top_config.currently_trained_net_id
conv_net = ConvNet.ConvNet(net_config, train_config, net_id)
conv_net.train_network(top_config.model_id)
print("Finished Train!")
elif top_config.function == 'Simulation':
batch_size = 5000
if top_config.analyze_res_noise:
simutimes_for_anal_res_power = int(np.ceil(5e6 / float(top_config.K_code * batch_size)) * batch_size)
ibd.analyze_residual_noise(code, top_config, net_config, simutimes_for_anal_res_power, batch_size)
simutimes_range = np.array([np.ceil(1e7 / float(top_config.K_code * batch_size)) * batch_size, np.ceil(1e8 / float(top_config.K_code * batch_size)) * batch_size], np.int32)
ibd.simulation_colored_noise(code, top_config, net_config, simutimes_range, 1000, batch_size)
print("Finished Simulation!")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhoub86/BPCNN.git
git@gitee.com:zhoub86/BPCNN.git
zhoub86
BPCNN
BPCNN
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385