# Java深度学习 **Repository Path**: Mint-Space/DeepLearning ## Basic Information - **Project Name**: Java深度学习 - **Description**: Deeplearning for Java.Build multi-layer perceptron neural network with JAVA.Identify the MNIST handwritten digital datasets.The accuracy rate is around 80% - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 1 - **Created**: 2024-04-29 - **Last Updated**: 2025-07-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: Java, DeepLearning, 神经网络, 深度学习 ## README ## **Multi-layer Perception NeuralNetwork** # 多层感知器神经网络 使用Java类构建 Multi-layer Perception NeuralNetwork ```java public static void main(String[] args) { MultilayeredPerceptronNeuralNetworks multilayeredPerceptronNeuralNetworks = new MultilayeredPerceptronNeuralNetworks(); multilayeredPerceptronNeuralNetworks.run(); X = MnistRead.getImagesBinarization(MnistRead.TRAIN_IMAGES_FILE); XT = MnistRead.getImagesBinarization(MnistRead.TEST_IMAGES_FILE); Y = MnistRead.getLabels(MnistRead.TRAIN_LABELS_FILE); YT = MnistRead.getLabels(MnistRead.TEST_LABELS_FILE); //下面是CNN训练 ConvolutionLayer cl1 = new ConvolutionLayer(); cl1.setConvolutionNeuralNumber(6); cl1.setConvolutionLayerParameter(5, 1, 6, ActivationType.RELU); cl1.setPoolingLayerParameter(2, 2, 0, PoolingType.MaxPooling); ConvolutionLayer cl2 = new ConvolutionLayer(); cl2.setConvolutionNeuralNumber(16); cl2.setConvolutionLayerParameter(5, 1, 2, ActivationType.RELU); cl2.setPoolingLayerParameter(2, 2, 0, PoolingType.MaxPooling); ConvolutionLayer cl3 = new ConvolutionLayer(); cl3.setConvolutionNeuralNumber(18); cl3.setConvolutionLayerParameter(3, 1, 1, ActivationType.RELU); cl3.setPoolingLayerParameter(2, 2, 0, PoolingType.MaxPooling); Layer layer1 = new Layer(120, ActivationType.Sigmoid); Layer layer2 = new Layer(84, ActivationType.Sigmoid); Layer layer3 = new Layer(10, ActivationType.Sigmoid); ConvolutionLayerConfiguration clc = new ConvolutionLayerConfiguration(X, Y); clc.convolutionLayerConfiguration(cl1); clc.convolutionLayerConfiguration(cl2); clc.convolutionLayerConfiguration(cl3); clc.fullyConnectedLayerConfiguration(layer1); clc.fullyConnectedLayerConfiguration(layer2); clc.fullyConnectedLayerConfiguration(layer3); clc.learningRateConfiguration(0.05); clc.lossConfiguration(LossType.MeanSquareErrorLossFunction); clc.saveParameter("src/main/resources/DataSet/CNN.mode"); clc.train(); //下面是CNN模型读取运行 (可以学到90%) ConvolutionLayerConfiguration clc1 = new ConvolutionLayerConfiguration(XT, YT); clc1.readParameter("src/main/resources/DataSet/CNN.mode"); clc1.run(); } ``` ### 个人网站 [墨染随想](https://morn.ink) https://morn.ink 创建感知器网络层和感知器网络, 设置数据集和学习率以及误差函数, train就开始训练了。 激活函数有: Sigmoid RELU Softmax Tanh 损失函数有: MeanSquareErrorLossFunction L2LossFunction L1LossFunction SmoothL1LossFunction HuBerLossFunction 未实现 KullbackLeiblerDivergenceFunction CrossEntropyLossFunction SoftmaxLossFunction FocalLossFunction 未实现 训练准确率为84.3% ^_^ CNN 卷积神经网络准确率提升90%; 项目地址:https://gitee.com/Mint-Space/DeepLearning 项目打包: mvn -X clean package 路径 /src/main/resources/META-INF/native-image/ink.mint/deeplearning 下文件由以下命令生成 步骤 4:重新生成配置文件(推荐) 通过 GraalVM Agent 自动生成配置: ```BASH - 1. 运行应用并生成配置 java -agentlib:native-image-agent=config-output-dir=./config -jar ./deeplearning.jar - 2. 复制生成的配置到项目 cp -r config/* src/main/resources/META-INF/native-image/ mvn clean package -X ``` [多层感知器神经网络](https://gitee.com/Mint-Space/DeepLearning) ![微信支付宝](src/main/resources/DataSet/gitee.jpg) ![人工智能](https://pic1.zhimg.com/v2-f672a345fd1382a1c2954741ccd5a75d_r.jpg) 喜欢这个项目可以支持一下 模型正在优化中。。。。