2 Star 3 Fork 1

mathfan / javascript-ai-visualization

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
filterNet.md 3.43 KB
一键复制 编辑 原始数据 按行查看 历史
魏毅 提交于 2020-02-19 14:38 . 增加API

神经网络隐层权重

神经网络是由一堆权重数字组成(一般是由高斯随机数组成的矩阵),训练前需要加载初始化权重参数 net.load(weight),以下神经网络隐藏层需要权重参数

名称 说明 长度
conv2d 卷积神经网络 权重数量 = 神经元数量 + 余数
separableConv2d 可分离卷积神经网络 权重数量 = 深度卷积神经元数量 + 点积神经元数量 + 余数
batchNorm BN层 sub尺寸 + truediv尺寸

神经网络详细说明

查看

例子

const config = [{
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 3, 1],
	"pointwise_filter": [1, 1, 3, 16],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [2, 2],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 16, 1],
	"pointwise_filter": [1, 1, 16, 32],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [2, 2],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 32, 1],
	"pointwise_filter": [1, 1, 32, 64],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [2, 2],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 64, 1],
	"pointwise_filter": [1, 1, 64, 128],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [2, 2],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 128, 1],
	"pointwise_filter": [1, 1, 128, 256],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [2, 2],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 256, 1],
	"pointwise_filter": [1, 1, 256, 512],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "maxPool",
	"size": [2, 2],
	"strides": [1, 1],
	"padding": "same"
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 512, 1],
	"pointwise_filter": [1, 1, 512, 1024],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "separableConv2d",
	"pad": [
		[0, 0],
		[1, 1],
		[1, 1],
		[0, 0]
	],
	"depthwise_filter": [3, 3, 1024, 1],
	"pointwise_filter": [1, 1, 1024, 1024],
	"strides": [1, 1],
	"padding": "valid"
}, {
	"type": "leakyRelu",
	"slope": 0.10000000149011612
}, {
	"type": "conv2d",
	"pad": [],
	"filter": [1, 1, 1024, 25],
	"strides": [1, 1],
	"padding": "valid"
}];

// 声明权重工具类
const initWeights = new yolo.InitWeights();

// 获取YOLO初始化权重
const weights = initWeights.init(config).getData();

console.log(weights); // => [Guss Random]
JavaScript
1
https://gitee.com/mathfan/AI-visualization.git
git@gitee.com:mathfan/AI-visualization.git
mathfan
AI-visualization
javascript-ai-visualization
master

搜索帮助