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
| use Amp\Loop; | |
| use Amp\Mysql\ConnectionConfig; | |
| use Amp\Mysql\Pool; | |
| use Amp\Mysql\ResultSet; | |
| use Amp\Mysql\TimeoutConnector; | |
| use Amp\Socket\ClientTlsContext; | |
| use Illuminate\Support\Collection; | |
| class AsyncMySql { | |
| private const DEFAULT_MAX_CONNECTIONS = 20; |
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
| $dbConfig = [ | |
| 'driver' => <data>, | |
| 'host' => <data>, | |
| 'port' => <data>, | |
| 'database' => <data>, | |
| 'username' => <data>, | |
| 'password' => <data>, | |
| 'charset' => <data>, | |
| 'collation' => <data>, | |
| 'prefix' => '', |
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
| $sslOption = null; | |
| if(isset($dbConfig['options'][\PDO::MYSQL_ATTR_SSL_CA])) { | |
| $sslOption = new ClientTlsContext(); | |
| $sslOption->withCaFile($dbConfig['options'][\PDO::MYSQL_ATTR_SSL_CA]); | |
| } | |
| $host = $dbConfig['host']; | |
| $port = $dbConfig['port']; | |
| $user = $dbConfig['username']; |
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
| #0 C:\htdocs\import\vendor\amphp\dns\lib\BasicResolver.php(138): Amp\Dns\ResolutionException: All query attempts failed | |
| #1 (0): Amp\Dns\{closure}() | |
| #2 C:\htdocs\import\vendor\amphp\amp\lib\Coroutine.php(71): throw(Amp\MultiReasonException#1 | |
| ( | |
| [Amp\MultiReasonException:reasons] => array | |
| ( | |
| [0] => Am...) | |
| #3 C:\htdocs\import\vendor\amphp\amp\lib\Failure.php(26): Amp\{closure}(Amp\MultiReasonException#1 | |
| ( | |
| [Amp\MultiReasonException:reasons] => array |
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
| #0 C:\htdocs\vendor\amphp\mysql\src\Internal\Processor.php(201): Amp\Mysql\ConnectionException: Connection went away... unable to fulfil this deferred ... It's unknown whether the query was executed... | |
| #1 C:\htdocs\vendor\amphp\amp\lib\Internal\Placeholder.php(127): Amp\Mysql\Internal\{closure}(null, null) | |
| #2 C:\htdocs\vendor\amphp\amp\lib\Coroutine.php(79): resolve(null) | |
| #3 C:\htdocs\vendor\amphp\amp\lib\Internal\Placeholder.php(127): Amp\{closure}(null, null) | |
| #4 C:\htdocs\vendor\amphp\amp\lib\Deferred.php(41): resolve(null) | |
| #5 C:\htdocs\vendor\amphp\byte-stream\lib\ResourceInputStream.php(177): resolve() | |
| #6 C:\htdocs\vendor\amphp\byte-stream\lib\ResourceInputStream.php(165): free() | |
| #7 C:\htdocs\vendor\amphp\socket\src\Socket.php(104): close() | |
| #8 C:\htdocs\vendor\amphp\mysql\src\Internal\Processor.php(1073): close() | |
| #9 C:\htdocs\vendor\amphp\mysql\src\Internal\Processor.php(1354): close() |
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
| package DeepLearning4J.example | |
| import java.io.File; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import org.canova.api.records.reader.RecordReader; | |
| import org.canova.api.split.FileSplit; | |
| import org.canova.image.loader.BaseImageLoader; | |
| import org.canova.image.loader.NativeImageLoader; |
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
| while (dataIter.hasNext()) { | |
| dsNext = dataIter.next(); | |
| network.fit(dsNext); | |
| } |
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
| package trainer; | |
| import org.deeplearning4j.nn.api.OptimizationAlgorithm; | |
| import org.deeplearning4j.nn.conf.GradientNormalization; | |
| import org.deeplearning4j.nn.conf.MultiLayerConfiguration; | |
| import org.deeplearning4j.nn.conf.NeuralNetConfiguration; | |
| import org.deeplearning4j.nn.conf.Updater; | |
| import org.deeplearning4j.nn.conf.layers.ConvolutionLayer; | |
| import org.deeplearning4j.nn.conf.layers.DenseLayer; | |
| import org.deeplearning4j.nn.conf.layers.LocalResponseNormalization; |
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
| INDArray predict(MultiLayerNetwork model, File imageFile) throws Exception { | |
| ImageLoader imageLoader = new ImageLoader(Config.IMAGE_WIDTH, Config.IMAGE_HEIGHT, Config.CHANNELS); | |
| INDArray image = imageLoader.asRowVector(imageFile); | |
| return model.output(image); | |
| } |
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
| RecordReader recordReader = new ImageRecordReader(Config.IMAGE_WIDTH, Config.IMAGE_HEIGHT, Config.CHANNELS, true); | |
| recordReader.initialize(new FileSplit(new File("directory"), BaseImageLoader.ALLOWED_FORMATS)); | |
| DataSetIterator dataIter = new RecordReaderDataSetIterator(recordReader, batchSize, -1, numLabels); | |
| while (dataIter.hasNext()) { | |
| dsNext = dataIter.next(); | |
| dsNext.scale(); | |
| network.fit(dsNext); | |
| } |