antoniogweb/php2xai-mnist 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

antoniogweb/php2xai-mnist

最新稳定版本:v0.1.1

Composer 安装命令:

composer create-project antoniogweb/php2xai-mnist

包简介

MNIST classification exercise built on PHP2xAI.

README 文档

README

MNIST classification exercise built on PHP2xAI. The project demonstrates dataset preprocessing in PHP, configuration of the computational graph, and training orchestration, while model training and inference are executed by the C++ runtime.

Installation

composer create-project antoniogweb/php2xai-mnist

Training

Run the script from src/:

cd src
php train.php

What it does:

  • Reads data from src/DataLabelInt/Training/train.txt and src/DataLabelInt/Training/test.txt.
  • Trains the model and saves weights to src/Output/weights.json.

PHP or C++ runtime:

  • In src/train.php you will find setRuntime("CPP"): it uses the C++ runtime.
  • To use the PHP runtime, replace it with setRuntime("PHP") or remove the call.

Batch size:

  • The second argument of StreamFileDataset controls the batch size.
  • In src/train.php, edit new StreamFileDataset($path."/train.txt", 1024) (and the validation dataset if needed).

Validation

Run the script from src/:

cd src
php validate.php

What it does:

  • Loads the model from src/model.json and weights from src/Output/weights.json.
  • Computes accuracy and inference time on the test set.

PHP or C++ runtime:

  • In src/validate.php you will find setRuntime("CPP"): it uses the C++ runtime.
  • To use the PHP runtime, replace it with setRuntime("PHP") or remove the call.

Notes

  • If you don't have train.txt and test.txt yet, generate them with src/create_data_one_file.php (requires images in src/images/).

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2026-01-07