ruby-dnn 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -1
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +32 -19
- data/Rakefile +0 -0
- data/examples/api-examples/early_stopping_example.rb +0 -0
- data/examples/api-examples/initializer_example.rb +0 -0
- data/examples/api-examples/regularizer_example.rb +0 -0
- data/examples/api-examples/save_example.rb +0 -0
- data/examples/cifar100_example.rb +0 -0
- data/examples/cifar10_example.rb +0 -0
- data/examples/dcgan/dcgan.rb +1 -1
- data/examples/dcgan/imgen.rb +0 -0
- data/examples/dcgan/train.rb +0 -0
- data/examples/iris_example.rb +0 -0
- data/examples/judge-number/README.md +0 -0
- data/examples/judge-number/capture.PNG +0 -0
- data/examples/judge-number/convnet8.rb +0 -0
- data/examples/judge-number/make_weights.rb +0 -0
- data/examples/judge-number/mnist_predict.rb +0 -0
- data/examples/judge-number/mnist_train.rb +0 -0
- data/examples/judge-number/public/httpRequest.js +0 -0
- data/examples/judge-number/public/judgeNumber.js +0 -0
- data/examples/judge-number/server.rb +0 -0
- data/examples/judge-number/trained_mnist_params.marshal +0 -0
- data/examples/judge-number/views/index.erb +0 -0
- data/examples/mnist_conv2d_example.rb +0 -0
- data/examples/mnist_define_by_run.rb +0 -0
- data/examples/mnist_example.rb +0 -0
- data/examples/mnist_gpu.rb +0 -0
- data/examples/mnist_lstm_example.rb +0 -0
- data/examples/pix2pix/dcgan.rb +0 -0
- data/examples/pix2pix/imgen.rb +0 -0
- data/examples/pix2pix/train.rb +0 -0
- data/examples/vae.rb +0 -0
- data/examples/xor_example.rb +0 -0
- data/ext/rb_stb_image/extconf.rb +0 -0
- data/ext/rb_stb_image/rb_stb_image.c +0 -0
- data/img/cart-pole.gif +0 -0
- data/img/cycle-gan.PNG +0 -0
- data/img/facade-pix2pix.png +0 -0
- data/lib/dnn.rb +0 -0
- data/lib/dnn/core/callbacks.rb +0 -0
- data/lib/dnn/core/error.rb +0 -0
- data/lib/dnn/core/global.rb +0 -0
- data/lib/dnn/core/initializers.rb +0 -0
- data/lib/dnn/core/iterator.rb +0 -0
- data/lib/dnn/core/layers/activations.rb +0 -0
- data/lib/dnn/core/layers/basic_layers.rb +0 -0
- data/lib/dnn/core/layers/cnn_layers.rb +0 -0
- data/lib/dnn/core/layers/embedding.rb +0 -0
- data/lib/dnn/core/layers/math_layers.rb +0 -0
- data/lib/dnn/core/layers/merge_layers.rb +0 -0
- data/lib/dnn/core/layers/normalizations.rb +0 -0
- data/lib/dnn/core/layers/rnn_layers.rb +0 -0
- data/lib/dnn/core/layers/split_layers.rb +0 -0
- data/lib/dnn/core/link.rb +0 -0
- data/lib/dnn/core/losses.rb +0 -0
- data/lib/dnn/core/models.rb +0 -0
- data/lib/dnn/core/monkey_patch.rb +0 -0
- data/lib/dnn/core/optimizers.rb +0 -0
- data/lib/dnn/core/param.rb +0 -0
- data/lib/dnn/core/regularizers.rb +0 -0
- data/lib/dnn/core/savers.rb +0 -0
- data/lib/dnn/core/tensor.rb +0 -0
- data/lib/dnn/core/utils.rb +0 -0
- data/lib/dnn/datasets/cifar10.rb +0 -0
- data/lib/dnn/datasets/cifar100.rb +0 -0
- data/lib/dnn/datasets/downloader.rb +0 -0
- data/lib/dnn/datasets/fashion-mnist.rb +0 -0
- data/lib/dnn/datasets/iris.rb +0 -0
- data/lib/dnn/datasets/mnist.rb +0 -0
- data/lib/dnn/datasets/stl-10.rb +0 -0
- data/lib/dnn/image.rb +0 -0
- data/lib/dnn/keras-model-convertor.rb +0 -0
- data/lib/dnn/numo2numpy.rb +0 -0
- data/lib/dnn/version.rb +1 -1
- data/ruby-dnn.gemspec +2 -15
- data/third_party/stb_image.h +0 -0
- data/third_party/stb_image_resize.h +0 -0
- data/third_party/stb_image_write.h +0 -0
- metadata +27 -20
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa12b717ef532b8afe44de7cb388c7d87cb271bf38a25adaad2c335c8817d4b
|
4
|
+
data.tar.gz: e1322f86b06c11ac3728e948e18469ccc6e454eeefb180108a0a9bfc2dbd8143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9c53ca73a5ab7fc53935f37e0804d761e36735aa06972f63e151ce76a44f01878a2c01dfe0622bf39baa5c98b16ee8d06db212356fcc329a9dd40ae2d78f1c
|
7
|
+
data.tar.gz: 5a195c0afd677127afad2433df2fda3a09c711464c46cb174713d00d695026d2b86faa64f82cc96f2b417b468fc372c04efee22761800c900e2f6b0ca05ac57d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# ruby-dnn
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/ruby-dnn.svg)](https://badge.fury.io/rb/ruby-dnn)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/ruby-dnn.svg)](https://badge.fury.io/rb/ruby-dnn)
|
3
3
|
[![Build Status](https://travis-ci.org/unagiootoro/ruby-dnn.svg?branch=master)](https://travis-ci.org/unagiootoro/ruby-dnn)
|
4
|
+
[![Docs Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://rubydoc.info/gems/ruby-dnn)
|
4
5
|
|
5
6
|
ruby-dnn is a ruby deep learning library. This library supports full connected neural network and convolution neural network
|
6
7
|
and recurrent neural network.
|
@@ -84,6 +85,23 @@ puts "loss: #{loss}"
|
|
84
85
|
Please refer to examples for basic usage.
|
85
86
|
If you want to know more detailed information, please refer to the source code.
|
86
87
|
|
88
|
+
## Sample
|
89
|
+
|
90
|
+
* Pix2pix
|
91
|
+
Convert an abstract image into a building image.
|
92
|
+
[https://github.com/unagiootoro/facade-pix2pix](https://github.com/unagiootoro/facade-pix2pix)
|
93
|
+
![facade-pix2pix.png](img/facade-pix2pix.png)
|
94
|
+
|
95
|
+
* Cycle-GAN
|
96
|
+
Convert apples to oranges and oranges to apples.
|
97
|
+
[https://github.com/unagiootoro/apple2orange-cyclegan](https://github.com/unagiootoro/apple2orange-cyclegan)
|
98
|
+
![cycle-gan.PNG](img/cycle-gan.PNG)
|
99
|
+
|
100
|
+
* DQN
|
101
|
+
Learn the game so that the pole on the cart does not fall.
|
102
|
+
[https://github.com/unagiootoro/ruby-rl](https://github.com/unagiootoro/ruby-rl)
|
103
|
+
![cart-pole.gif](img/cart-pole.gif)
|
104
|
+
|
87
105
|
## Implemented
|
88
106
|
|| Implemented classes |
|
89
107
|
|:-----------|------------:|
|
@@ -95,32 +113,27 @@ If you want to know more detailed information, please refer to the source code.
|
|
95
113
|
| Losses | MeanSquaredError, MeanAbsoluteError, Hinge, HuberLoss, SoftmaxCrossEntropy, SigmoidCrossEntropy |
|
96
114
|
|
97
115
|
## Datasets
|
98
|
-
By setting the environment variable
|
99
|
-
|
100
|
-
● Iris
|
101
|
-
● MNIST
|
102
|
-
● Fashion-MNIST
|
103
|
-
● CIFAR-10
|
104
|
-
● CIFAR-100
|
105
|
-
● STL-10
|
116
|
+
By setting the environment variable `RUBY_DNN_DOWNLOADS_PATH`, you can specify the path to read dataset.
|
106
117
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
118
|
+
* Iris
|
119
|
+
* MNIST
|
120
|
+
* Fashion-MNIST
|
121
|
+
* CIFAR-10
|
122
|
+
* CIFAR-100
|
123
|
+
* STL-10
|
111
124
|
|
112
125
|
## Use GPU
|
113
|
-
If you do
|
114
|
-
Or, set the environment variable
|
126
|
+
If you do `require "cumo/narray"` before `require "dnn"`, you can run it on GPU.
|
127
|
+
Or, set the environment variable `RUBY_DNN_USE_CUMO` to `ENABLE` to force the GPU to be used.
|
115
128
|
|
116
129
|
## TODO
|
117
|
-
|
118
|
-
|
119
|
-
|
130
|
+
* Write a test.
|
131
|
+
* Write a document.
|
132
|
+
* Improve performance when using GPU.
|
120
133
|
|
121
134
|
## Development
|
122
135
|
|
123
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake "
|
136
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake "test"` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
124
137
|
|
125
138
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
126
139
|
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/examples/cifar10_example.rb
CHANGED
File without changes
|
data/examples/dcgan/dcgan.rb
CHANGED
@@ -129,7 +129,7 @@ class DCGAN < Model
|
|
129
129
|
y_fake = Numo::SFloat.zeros(batch_size, 1)
|
130
130
|
@dis.enable_training
|
131
131
|
dis_loss = @dis.train_on_batch(x_batch, y_real)
|
132
|
-
dis_loss
|
132
|
+
dis_loss += @dis.train_on_batch(images, y_fake)
|
133
133
|
|
134
134
|
noise = Numo::SFloat.new(batch_size, 20).rand(-1, 1)
|
135
135
|
label = Numo::SFloat.cast([1] * batch_size).reshape(batch_size, 1)
|
data/examples/dcgan/imgen.rb
CHANGED
File without changes
|
data/examples/dcgan/train.rb
CHANGED
File without changes
|
data/examples/iris_example.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/examples/mnist_example.rb
CHANGED
File without changes
|
data/examples/mnist_gpu.rb
CHANGED
File without changes
|
File without changes
|
data/examples/pix2pix/dcgan.rb
CHANGED
File without changes
|
data/examples/pix2pix/imgen.rb
CHANGED
File without changes
|
data/examples/pix2pix/train.rb
CHANGED
File without changes
|
data/examples/vae.rb
CHANGED
File without changes
|
data/examples/xor_example.rb
CHANGED
File without changes
|
data/ext/rb_stb_image/extconf.rb
CHANGED
File without changes
|
File without changes
|
data/img/cart-pole.gif
ADDED
Binary file
|
data/img/cycle-gan.PNG
ADDED
Binary file
|
Binary file
|
data/lib/dnn.rb
CHANGED
File without changes
|
data/lib/dnn/core/callbacks.rb
CHANGED
File without changes
|
data/lib/dnn/core/error.rb
CHANGED
File without changes
|
data/lib/dnn/core/global.rb
CHANGED
File without changes
|
File without changes
|
data/lib/dnn/core/iterator.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/dnn/core/link.rb
CHANGED
File without changes
|
data/lib/dnn/core/losses.rb
CHANGED
File without changes
|
data/lib/dnn/core/models.rb
CHANGED
File without changes
|
File without changes
|
data/lib/dnn/core/optimizers.rb
CHANGED
File without changes
|
data/lib/dnn/core/param.rb
CHANGED
File without changes
|
File without changes
|
data/lib/dnn/core/savers.rb
CHANGED
File without changes
|
data/lib/dnn/core/tensor.rb
CHANGED
File without changes
|
data/lib/dnn/core/utils.rb
CHANGED
File without changes
|
data/lib/dnn/datasets/cifar10.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/dnn/datasets/iris.rb
CHANGED
File without changes
|
data/lib/dnn/datasets/mnist.rb
CHANGED
File without changes
|
data/lib/dnn/datasets/stl-10.rb
CHANGED
File without changes
|
data/lib/dnn/image.rb
CHANGED
File without changes
|
File without changes
|
data/lib/dnn/numo2numpy.rb
CHANGED
File without changes
|
data/lib/dnn/version.rb
CHANGED
data/ruby-dnn.gemspec
CHANGED
@@ -17,21 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.add_dependency "numo-narray"
|
19
19
|
spec.add_dependency "archive-tar-minitar"
|
20
|
-
spec.add_dependency "yard"
|
21
20
|
|
22
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
23
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.7
|
24
|
-
=begin
|
25
|
-
if spec.respond_to?(:metadata)
|
26
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
27
|
-
else
|
28
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
29
|
-
"public gem pushes."
|
30
|
-
end
|
31
|
-
=end
|
32
|
-
|
33
|
-
# Specify which files should be added to the gem when it is released.
|
34
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
35
21
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
36
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
37
23
|
end
|
@@ -39,7 +25,8 @@ Gem::Specification.new do |spec|
|
|
39
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
40
26
|
spec.require_paths = ["lib"]
|
41
27
|
|
42
|
-
spec.add_development_dependency "bundler", "
|
28
|
+
spec.add_development_dependency "bundler", ">= 1.16", "<3.0"
|
43
29
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
44
30
|
spec.add_development_dependency "minitest", "~> 5.0"
|
31
|
+
spec.add_development_dependency "yard"
|
45
32
|
end
|
data/third_party/stb_image.h
CHANGED
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-dnn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unagiootoro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -38,34 +38,26 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: yard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: '1.16'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '3.0'
|
62
51
|
type: :development
|
63
52
|
prerelease: false
|
64
53
|
version_requirements: !ruby/object:Gem::Requirement
|
65
54
|
requirements:
|
66
|
-
- - "
|
55
|
+
- - ">="
|
67
56
|
- !ruby/object:Gem::Version
|
68
57
|
version: '1.16'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.0'
|
69
61
|
- !ruby/object:Gem::Dependency
|
70
62
|
name: rake
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +86,20 @@ dependencies:
|
|
94
86
|
- - "~>"
|
95
87
|
- !ruby/object:Gem::Version
|
96
88
|
version: '5.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: yard
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
97
103
|
description: ruby-dnn is a ruby deep learning library.
|
98
104
|
email:
|
99
105
|
- ootoro838861@outlook.jp
|
@@ -109,8 +115,6 @@ files:
|
|
109
115
|
- LICENSE.txt
|
110
116
|
- README.md
|
111
117
|
- Rakefile
|
112
|
-
- bin/console
|
113
|
-
- bin/setup
|
114
118
|
- examples/api-examples/early_stopping_example.rb
|
115
119
|
- examples/api-examples/initializer_example.rb
|
116
120
|
- examples/api-examples/regularizer_example.rb
|
@@ -144,6 +148,9 @@ files:
|
|
144
148
|
- examples/xor_example.rb
|
145
149
|
- ext/rb_stb_image/extconf.rb
|
146
150
|
- ext/rb_stb_image/rb_stb_image.c
|
151
|
+
- img/cart-pole.gif
|
152
|
+
- img/cycle-gan.PNG
|
153
|
+
- img/facade-pix2pix.png
|
147
154
|
- lib/dnn.rb
|
148
155
|
- lib/dnn/core/callbacks.rb
|
149
156
|
- lib/dnn/core/error.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "dnn"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|