lib/dnn/datasets/stl-10.rb in ruby-dnn-0.16.2 vs lib/dnn/datasets/stl-10.rb in ruby-dnn-1.0.0
- old
+ new
@@ -5,11 +5,11 @@
URL_STL10 = "http://ai.stanford.edu/~acoates/stl10/stl10_binary.tar.gz"
DIR_STL10 = "stl10_binary"
module DNN
module STL10
- class DNN_STL10_LoadError < DNN_Error; end
+ class DNN_STL10_LoadError < DNNError; end
def self.downloads
return if Dir.exist?(DOWNLOADS_PATH + "/downloads/" + DIR_STL10)
Downloader.download(URL_STL10)
stl10_binary_file_name = DOWNLOADS_PATH + "/downloads/" + URL_STL10.match(%r`.+/(.+)`)[1]
@@ -47,10 +47,10 @@
y_test = Numo::UInt8.from_binary(y_bin)
[x_test, y_test]
end
def self.load_unlabeled(range = 0...100000)
- raise DNN_Error, "Range must between 0 and 100000. (But the end is excluded)" unless range.begin >= 0 && range.end <= 100000
+ raise DNNError, "Range must between 0 and 100000. (But the end is excluded)" unless range.begin >= 0 && range.end <= 100000
downloads
x_fname = DOWNLOADS_PATH + "/downloads/#{DIR_STL10}/unlabeled_X.bin"
raise DNN_STL10_LoadError, %`file "#{x_fname}" is not found.` unless File.exist?(x_fname)
num_datas = range.end - range.begin
length = num_datas * 3 * 96 * 96