1. Go to this page and download the library: Download rubix/cifar-10 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Rubix\ML\Datasets\Labeled;
$dataset = new Labeled($samples, $labels);
use Rubix\ML\PersistentModel;
use Rubix\ML\Pipeline;
use Rubix\ML\Transformers\ImageResizer;
use Rubix\ML\Transformers\ImageVectorizer;
use Rubix\ML\Transformers\ZScaleStandardizer;
use Rubix\ML\Classifiers\MultilayerPerceptron;
use Rubix\ML\NeuralNet\Layers\Dense;
use Rubix\ML\NeuralNet\Layers\Activation;
use Rubix\ML\NeuralNet\Layers\Dropout;
use Rubix\ML\NeuralNet\Layers\BatchNorm;
use Rubix\ML\NeuralNet\ActivationFunctions\ELU;
use Rubix\ML\NeuralNet\Optimizers\Adam;
use Rubix\ML\Persisters\Filesystem;
$estimator = new PersistentModel(
new Pipeline([
new ImageResizer(32, 32),
new ImageVectorizer(),
new ZScaleStandardizer(),
], new MultilayerPerceptron([
new Dense(200),
new Activation(new ELU()),
new Dropout(0.5),
new Dense(200),
new Activation(new ELU()),
new Dropout(0.5),
new Dense(100, 0.0, false),
new BatchNorm(),
new Activation(new ELU()),
new Dense(100),
new Activation(new ELU()),
new Dense(50),
new Activation(new ELU()),
], 256, new Adam(0.0005))),
new Filesystem('cifar10.rbx', true)
);
$estimator->train($dataset);
use Rubix\ML\Extractors\CSV;
$extractor = new CSV('progress.csv', true);
$extractor->export($estimator->steps());
use Rubix\ML\Datasets\Labeled;
$dataset = new Labeled($samples, $labels);
use Rubix\ML\PersistentModel;
use Rubix\ML\Persisters\Filesystem;
$estimator = PersistentModel::load(new Filesystem('cifar10.rbx'));
$predictions = $estimator->predict($dataset);
use Rubix\ML\CrossValidation\Reports\AggregateReport;
use Rubix\ML\CrossValidation\Reports\ConfusionMatrix;
use Rubix\ML\CrossValidation\Reports\MulticlassBreakdown;
$report = new AggregateReport([
new MulticlassBreakdown(),
new ConfusionMatrix(),
]);
$results = $report->generate($predictions, $dataset->labels());
$ php validate.php
sh
$ php train.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.