FNN 消融实验:各改进组件对 MNIST 分类精度的贡献分析#6036
Open
Calvin1989 wants to merge 6 commits intoOpenHUTB:mainfrom
Open
Conversation
- 在画面 58% 高度处绘制金黄色虚线围栏(VIRTUAL FENCE) - 检测目标越线时框变橙红色并显示 !INTRUSION! 标签 - 上升沿计数入侵事件(同一批目标持续越线只计1次) - 围栏线在入侵时闪烁变色,屏幕四周出现橙色边框警报 - V2X 面板新增 Intrusions 入侵事件计数行 - V2X 广播最高优先级推送 FENCE BREACH 消息
Compare 5 configurations (Baseline / +Dropout / +BN / +BN+Dropout / Enhanced) to quantify the contribution of each improvement component. Key results: - Baseline (784->128->10): 98.04% test accuracy - Enhanced (deeper+BN+Dropout+LR schedule): 98.46% test accuracy (+0.43%) - Generates 4 comparison plots: train/test accuracy curves, loss curve, bar chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
原始代码
tutorial_minst_fnn-tf2.0-exercise.py存在以下问题:新增文件
src/chap04_simple_neural_network/fnn_ablation_study.py实验设计
对以下 5 种模型配置进行对比训练(EPOCHS=20,BATCH_SIZE=256,Adam lr=1e-3):
实验结果
最佳测试准确率对比
结果图
测试集准确率曲线
训练集准确率曲线
训练 Loss 曲线
最终测试准确率柱状图
关键发现(消融结论)
单独引入 BatchNorm(Config-C/D)对浅层网络效果有限甚至略负:BN 在隐藏层只有 128 个神经元的浅层结构中,带来了轻微的测试精度下降(-0.25%),说明 BN 的收益需要足够深的网络才能体现。
Dropout 对浅层网络正则化效果温和(Config-B,+0.06%):在简单任务上轻微改善泛化,增益不显著。
多组件协同使用效果显著(Config-E,+0.43%):更深的网络结合 BN、Dropout、He 初始化和学习率调度,最终实现最优测试准确率 98.46%。
训练集 vs 测试集对比揭示过拟合:Config-C 训练准确率趋近 1.0,但测试集低于 Baseline,印证了浅层+BN 存在过拟合。
运行方式
cd src/chap04_simple_neural_network python fnn_ablation_study.py