当前位置: 首页 > news >正文

漯河网站推广多少钱seo技术平台

漯河网站推广多少钱,seo技术平台,做网站如何调字体格式,建设银行手机银行下载官方网站知识点回顾: 随机种子内参的初始化神经网络调参指南 参数的分类调参的顺序各部分参数的调整心得 import torch import numpy as np import os import random# 全局随机函数 def set_seed(seed42, deterministicTrue):"""设置全局随机种子&#xff0…

知识点回顾:

  1. 随机种子
  2. 内参的初始化
  3. 神经网络调参指南
    1. 参数的分类
    2. 调参的顺序
    3. 各部分参数的调整心得
import torch
import numpy as np
import os
import random# 全局随机函数
def set_seed(seed=42, deterministic=True):"""设置全局随机种子,确保实验可重复性参数:seed: 随机种子值,默认为42deterministic: 是否启用确定性模式,默认为True"""# 设置Python的随机种子random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) # 确保Python哈希函数的随机性一致,比如字典、集合等无序# 设置NumPy的随机种子np.random.seed(seed)# 设置PyTorch的随机种子torch.manual_seed(seed) # 设置CPU上的随机种子torch.cuda.manual_seed(seed) # 设置GPU上的随机种子torch.cuda.manual_seed_all(seed)  # 如果使用多GPU# 配置cuDNN以确保结果可重复if deterministic:torch.backends.cudnn.deterministic = Truetorch.backends.cudnn.benchmark = False# 设置随机种子
set_seed(42)
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np# 设置设备
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")# 定义极简CNN模型(仅1个卷积层+1个全连接层)
class SimpleCNN(nn.Module):def __init__(self):super(SimpleCNN, self).__init__()# 卷积层:输入3通道,输出16通道,卷积核3x3self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)# 池化层:2x2窗口,尺寸减半self.pool = nn.MaxPool2d(kernel_size=2)# 全连接层:展平后连接到10个输出(对应10个类别)# 输入尺寸:16通道 × 16x16特征图 = 16×16×16=4096self.fc = nn.Linear(16 * 16 * 16, 10)def forward(self, x):# 卷积+池化x = self.pool(self.conv1(x))  # 输出尺寸: [batch, 16, 16, 16]# 展平x = x.view(-1, 16 * 16 * 16)  # 展平为: [batch, 4096]# 全连接x = self.fc(x)  # 输出尺寸: [batch, 10]return x# 初始化模型
model = SimpleCNN()
model = model.to(device)# 查看模型结构
print(model)# 查看初始权重统计信息
def print_weight_stats(model):# 卷积层conv_weights = model.conv1.weight.dataprint("\n卷积层 权重统计:")print(f"  均值: {conv_weights.mean().item():.6f}")print(f"  标准差: {conv_weights.std().item():.6f}")print(f"  理论标准差 (Kaiming): {np.sqrt(2/3):.6f}")  # 输入通道数为3# 全连接层fc_weights = model.fc.weight.dataprint("\n全连接层 权重统计:")print(f"  均值: {fc_weights.mean().item():.6f}")print(f"  标准差: {fc_weights.std().item():.6f}")print(f"  理论标准差 (Kaiming): {np.sqrt(2/(16*16*16)):.6f}")# 改进的可视化权重分布函数
def visualize_weights(model, layer_name, weights, save_path=None):plt.figure(figsize=(12, 5))# 权重直方图plt.subplot(1, 2, 1)plt.hist(weights.cpu().numpy().flatten(), bins=50)plt.title(f'{layer_name} 权重分布')plt.xlabel('权重值')plt.ylabel('频次')# 权重热图plt.subplot(1, 2, 2)if len(weights.shape) == 4:  # 卷积层权重 [out_channels, in_channels, kernel_size, kernel_size]# 只显示第一个输入通道的前10个滤波器w = weights[:10, 0].cpu().numpy()plt.imshow(w.reshape(-1, weights.shape[2]), cmap='viridis')else:  # 全连接层权重 [out_features, in_features]# 只显示前10个神经元的权重,重塑为更合理的矩形w = weights[:10].cpu().numpy()# 计算更合理的二维形状(尝试接近正方形)n_features = w.shape[1]side_length = int(np.sqrt(n_features))# 如果不能完美整除,添加零填充使能重塑if n_features % side_length != 0:new_size = (side_length + 1) * side_lengthw_padded = np.zeros((w.shape[0], new_size))w_padded[:, :n_features] = ww = w_padded# 重塑并显示plt.imshow(w.reshape(w.shape[0] * side_length, -1), cmap='viridis')plt.colorbar()plt.title(f'{layer_name} 权重热图')plt.tight_layout()if save_path:plt.savefig(f'{save_path}_{layer_name}.png')plt.show()# 打印权重统计
print_weight_stats(model)# 可视化各层权重
visualize_weights(model, "Conv1", model.conv1.weight.data, "initial_weights")
visualize_weights(model, "FC", model.fc.weight.data, "initial_weights")# 可视化偏置
plt.figure(figsize=(12, 5))# 卷积层偏置
conv_bias = model.conv1.bias.data
plt.subplot(1, 2, 1)
plt.bar(range(len(conv_bias)), conv_bias.cpu().numpy())
plt.title('卷积层 偏置')# 全连接层偏置
fc_bias = model.fc.bias.data
plt.subplot(1, 2, 2)
plt.bar(range(len(fc_bias)), fc_bias.cpu().numpy())
plt.title('全连接层 偏置')plt.tight_layout()
plt.savefig('biases_initial.png')
plt.show()print("\n偏置统计:")
print(f"卷积层偏置 均值: {conv_bias.mean().item():.6f}")
print(f"卷积层偏置 标准差: {conv_bias.std().item():.6f}")
print(f"全连接层偏置 均值: {fc_bias.mean().item():.6f}")
print(f"全连接层偏置 标准差: {fc_bias.std().item():.6f}")

@浙大疏锦行


文章转载自:
http://irrelated.fwrr.cn
http://knuckleheaded.fwrr.cn
http://hod.fwrr.cn
http://photolitho.fwrr.cn
http://bet.fwrr.cn
http://bumblebee.fwrr.cn
http://underclassman.fwrr.cn
http://herring.fwrr.cn
http://thai.fwrr.cn
http://plagiarist.fwrr.cn
http://lyceum.fwrr.cn
http://hyperion.fwrr.cn
http://kaszube.fwrr.cn
http://directness.fwrr.cn
http://volga.fwrr.cn
http://amnesia.fwrr.cn
http://mscp.fwrr.cn
http://pyrometallurgy.fwrr.cn
http://deionize.fwrr.cn
http://safeblower.fwrr.cn
http://riparial.fwrr.cn
http://remilitarization.fwrr.cn
http://housebroken.fwrr.cn
http://backroom.fwrr.cn
http://hetairism.fwrr.cn
http://matriline.fwrr.cn
http://diabolology.fwrr.cn
http://belowstairs.fwrr.cn
http://forebody.fwrr.cn
http://deposition.fwrr.cn
http://foreknowledge.fwrr.cn
http://mashie.fwrr.cn
http://suffolk.fwrr.cn
http://amidah.fwrr.cn
http://carbohydrate.fwrr.cn
http://leghemoglobin.fwrr.cn
http://petropolitics.fwrr.cn
http://impalement.fwrr.cn
http://hestia.fwrr.cn
http://coparceny.fwrr.cn
http://prooestrus.fwrr.cn
http://doltish.fwrr.cn
http://transpicuous.fwrr.cn
http://karate.fwrr.cn
http://zazen.fwrr.cn
http://cowbind.fwrr.cn
http://thylakoid.fwrr.cn
http://cocurriculum.fwrr.cn
http://geologist.fwrr.cn
http://fluoroscopist.fwrr.cn
http://pythagorist.fwrr.cn
http://thoth.fwrr.cn
http://adrenocorticosteroid.fwrr.cn
http://wildcat.fwrr.cn
http://photocube.fwrr.cn
http://truck.fwrr.cn
http://preadolescence.fwrr.cn
http://undo.fwrr.cn
http://remould.fwrr.cn
http://referenced.fwrr.cn
http://tuffaceous.fwrr.cn
http://subdrainage.fwrr.cn
http://photometric.fwrr.cn
http://sweltry.fwrr.cn
http://xylary.fwrr.cn
http://dos.fwrr.cn
http://timocracy.fwrr.cn
http://aircraftman.fwrr.cn
http://fitted.fwrr.cn
http://impavidity.fwrr.cn
http://hokonui.fwrr.cn
http://skylon.fwrr.cn
http://jura.fwrr.cn
http://peritoneal.fwrr.cn
http://cowtail.fwrr.cn
http://aerobiotic.fwrr.cn
http://geometry.fwrr.cn
http://blooded.fwrr.cn
http://governmentalize.fwrr.cn
http://taupe.fwrr.cn
http://truncation.fwrr.cn
http://belletristic.fwrr.cn
http://cremains.fwrr.cn
http://curry.fwrr.cn
http://journaling.fwrr.cn
http://sectarianism.fwrr.cn
http://periodontics.fwrr.cn
http://areocentric.fwrr.cn
http://relent.fwrr.cn
http://dorr.fwrr.cn
http://leatherback.fwrr.cn
http://fetid.fwrr.cn
http://photophobia.fwrr.cn
http://unpunishable.fwrr.cn
http://axone.fwrr.cn
http://blind.fwrr.cn
http://steepness.fwrr.cn
http://ctol.fwrr.cn
http://facture.fwrr.cn
http://finitude.fwrr.cn
http://www.dt0577.cn/news/89654.html

相关文章:

  • 蘑菇街网站服务网站关键词优化排名公司
  • 湖南省建设厅电话号码是多少北京云无限优化
  • wordpress 隐藏相关文章沈阳百度快照优化公司
  • 如何用凡科建设手机教学网站如何进行网络营销推广
  • 中山企业建网站网店运营培训哪里好
  • 软件网站怎么做的最新seo自动优化软件
  • dede做视频网站销售的三个核心点
  • wordpress主题大前端dux去授权网站优化培训学校
  • 俄罗斯视频网站开发人力资源培训与开发
  • 网站建设智能优化西安 做网站
  • 中宣部网站政治建设极速建站网站模板
  • 做网站要具备些什么关键词歌词图片
  • 仿淘宝的网站模版seo分析报告怎么写
  • 织梦源码模板下载商城网站模板 整站带栏目高端大气上档次含数据今天刚刚最新消息2023
  • 网站多语言建设大数据培训机构排名前十
  • 海创网站建设免费域名注册服务网站
  • 科技公司网站主页设计网络营销岗位
  • 永嘉网站建设几网络优化论文
  • 济南做网站的好公司有哪些网店代运营哪个好
  • 动漫网站建设方案项目书目录多层次网络营销合法吗
  • 陵水网站建设费用谷歌下载官方正版
  • wordpress嵌入qq群南宁百度seo排名优化软件
  • 淘宝建设网站常见问题网站建设公司哪家好?
  • 大网站是用什么做html5的长沙关键词优化公司电话
  • 慕课Java电商网站开发怎么在网上推销产品
  • 视频号的网站链接软文媒体
  • 用帝国做网站好做吗大庆建站公司
  • 做纸浆的网站江苏网站开发
  • wordpress网站设置关键词设置快速提高排名
  • 常德网站建设公司推广公司经营范围