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.txtandsrc/DataLabelInt/Training/test.txt. - Trains the model and saves weights to
src/Output/weights.json.
PHP or C++ runtime:
- In
src/train.phpyou will findsetRuntime("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
StreamFileDatasetcontrols the batch size. - In
src/train.php, editnew 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.jsonand weights fromsrc/Output/weights.json. - Computes accuracy and inference time on the test set.
PHP or C++ runtime:
- In
src/validate.phpyou will findsetRuntime("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.txtandtest.txtyet, generate them withsrc/create_data_one_file.php(requires images insrc/images/).
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2026-01-07