red-datasets-gdk-pixbuf 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8e1a72cafe0dbe7ee41224c8a02bf20ad0696b1ea59b23569933443991f97cc
4
- data.tar.gz: 929476408cf9f08854a5b1e78e6b0456d6131b0afa494f0af68b1f87cabca85e
3
+ metadata.gz: 8fa73f042b76ddce2e093372f66843ded75b103a63242085254978480d1b9d1f
4
+ data.tar.gz: cd66b11a5efaa5880e064b26b85e19e90ab526a4df1b6cee12bb7a65a3ed257a
5
5
  SHA512:
6
- metadata.gz: 0ac6edbbb3b7769b6d13989d2aace041d4474620a3824f451e75df19f716f19734888a535c875f1f50ef41e6693b46a8bb465eaa4bd2cc83924b766f9054ce19
7
- data.tar.gz: f9810f4ed6a50f26240b582c81b6c2910760aab63d079fb562ab1d0453228baaf1db3b1a80d213a94e3e4d2a9b04002e648bbcaad25c7aa06f814a6ec325aacf
6
+ metadata.gz: d8282c97ab11450e5f2415ed200fb5bb8402df182f7e73769eeb37d28ad176c0db583a29d2a9216249a04e3771c3b2cebd79b675d58ccfe24366b501e6efe2af
7
+ data.tar.gz: a1f6d43b8769c5571106ff56bee8ee53b3fcb95178e5682b33b1a65a5c6ab65ff2a7c93264826ba60993e44dd7e06decc24f62253fac4bfc86415bee1f2ec89a
data/doc/text/news.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # News
2
2
 
3
+ ## 0.0.2 - 2018-11-30
4
+
5
+ ### Improvements
6
+
7
+ * Added support for MNIST dataset.
8
+ [GitHub#2][Patch by chimame]
9
+
10
+ * Added support for Fashion-MNIST dataset.
11
+ [GitHub#3][Patch by chimame]
12
+
13
+ ### Thanks
14
+
15
+ * chimame
16
+
3
17
  ## 0.0.1 - 2018-05-06
4
18
 
5
19
  Initial release!!!
@@ -3,3 +3,5 @@ require "datasets"
3
3
  require "datasets-gdk-pixbuf/version"
4
4
 
5
5
  require "datasets-gdk-pixbuf/cifar"
6
+ require "datasets-gdk-pixbuf/fashion-mnist"
7
+ require "datasets-gdk-pixbuf/mnist"
@@ -6,7 +6,9 @@ module DatasetsGdkPixbuf
6
6
  n_channels = 3
7
7
  width = 32
8
8
  height = 32
9
- rgb_data = pixels.each_slice(1024).to_a.transpose.flatten.pack("C*")
9
+ color_size = width * height
10
+ rgb_data = pixels.each_slice(color_size).to_a.transpose.flatten
11
+ rgb_data = rgb_data.pack("C*")
10
12
  GdkPixbuf::Pixbuf.new(:data => rgb_data,
11
13
  :row_stride => width * n_channels,
12
14
  :width => width,
@@ -0,0 +1,9 @@
1
+ require_relative "mnist-pixbufable"
2
+
3
+ module Datasets
4
+ class FashionMNIST
5
+ class Record
6
+ include DatasetsGdkPixbuf::MNISTPixbufable
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ require "gdk_pixbuf2"
2
+
3
+ module DatasetsGdkPixbuf
4
+ module MNISTPixbufable
5
+ def to_gdk_pixbuf
6
+ rgb_data = pixels.map{|p| [(p - 255).abs] * 3}.flatten
7
+ GdkPixbuf::Pixbuf.new(data: rgb_data.pack("C"),
8
+ width: 28,
9
+ height: 28)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require_relative "mnist-pixbufable"
2
+
3
+ module Datasets
4
+ class MNIST
5
+ class Record
6
+ include DatasetsGdkPixbuf::MNISTPixbufable
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module DatasetsGdkPixbuf
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -34,8 +34,8 @@ Gem::Specification.new do |spec|
34
34
  spec.files += Dir.glob("doc/text/*")
35
35
  spec.test_files += Dir.glob("test/**/*")
36
36
 
37
- spec.add_runtime_dependency("gdk_pixbuf2")
38
- spec.add_runtime_dependency("red-datasets", ">= 0.0.3")
37
+ spec.add_runtime_dependency("gdk_pixbuf2", ">= 3.3.0")
38
+ spec.add_runtime_dependency("red-datasets", ">= 0.0.7")
39
39
 
40
40
  spec.add_development_dependency("bundler")
41
41
  spec.add_development_dependency("rake")
data/test/test-cifar.rb CHANGED
@@ -1,4 +1,4 @@
1
- class IrisTest < Test::Unit::TestCase
1
+ class CIFARTest < Test::Unit::TestCase
2
2
  include Helper::Sandbox
3
3
 
4
4
  def setup_raw_data(data)
@@ -0,0 +1,10 @@
1
+ class FashionMNISTTest < Test::Unit::TestCase
2
+ def setup
3
+ @dataset = Datasets::FashionMNIST.new(type: :train)
4
+ end
5
+
6
+ test("#to_gdk_pixbuf") do
7
+ assert_equal([74, 74, 70, 70, 70, 67, 67, 67, 66, 66],
8
+ @dataset.to_a.first.to_gdk_pixbuf.pixels[1960, 10])
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class MNISTTest < Test::Unit::TestCase
2
+ def setup
3
+ @dataset = Datasets::MNIST.new(type: :train)
4
+ end
5
+
6
+ test("#to_gdk_pixbuf") do
7
+ assert_equal([2, 2, 2, 2, 2, 11, 11, 11, 122, 122],
8
+ @dataset.to_a.first.to_gdk_pixbuf.pixels[1960, 10])
9
+ end
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red-datasets-gdk-pixbuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2018-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gdk_pixbuf2
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: red-datasets
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.3
33
+ version: 0.0.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.3
40
+ version: 0.0.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -126,11 +126,16 @@ files:
126
126
  - doc/text/news.md
127
127
  - lib/datasets-gdk-pixbuf.rb
128
128
  - lib/datasets-gdk-pixbuf/cifar.rb
129
+ - lib/datasets-gdk-pixbuf/fashion-mnist.rb
130
+ - lib/datasets-gdk-pixbuf/mnist-pixbufable.rb
131
+ - lib/datasets-gdk-pixbuf/mnist.rb
129
132
  - lib/datasets-gdk-pixbuf/version.rb
130
133
  - red-datasets-gdk-pixbuf.gemspec
131
134
  - test/helper.rb
132
135
  - test/run-test.rb
133
136
  - test/test-cifar.rb
137
+ - test/test-fashion-mnist.rb
138
+ - test/test-mnist.rb
134
139
  homepage: https://github.com/red-data-tools/red-datasets-gdk-pixbuf
135
140
  licenses:
136
141
  - MIT
@@ -151,12 +156,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
156
  version: '0'
152
157
  requirements: []
153
158
  rubyforge_project:
154
- rubygems_version: 2.7.6
159
+ rubygems_version: 3.0.0.beta2
155
160
  signing_key:
156
161
  specification_version: 4
157
162
  summary: Red Datasets GDK Pixbuf adds [GDK Pixbuf](https://developer.gnome.org/gdk-pixbuf/stable/)
158
163
  object export feature to Red Datasets.
159
164
  test_files:
165
+ - test/test-fashion-mnist.rb
166
+ - test/test-mnist.rb
160
167
  - test/helper.rb
161
168
  - test/run-test.rb
162
169
  - test/test-cifar.rb