Sha256: f23a2cec0e59b9896a3a49292b8bb2254e864c94b207a69a91e7e8ec158c8be9
Contents?: true
Size: 626 Bytes
Versions: 4
Compression:
Stored size: 626 Bytes
Contents
require "dnn" require "dnn/image" require "numo/linalg/autoloader" require_relative "dcgan" include DNN::Loaders Image = DNN::Image batch_size = 100 gen = Generator.new dis = Discriminator.new dcgan = DCGAN.new(gen, dis) dcgan.predict1(Numo::SFloat.zeros(20)) loader = MarshalLoader.new(dcgan) loader.load("trained/dcgan_model_epoch20.marshal") Numo::SFloat.srand(rand(1 << 31)) noise = Numo::SFloat.new(batch_size, 20).rand(-1, 1) images = gen.predict(noise) batch_size.times do |i| img = Numo::UInt8.cast(((images[i, false] + 1) * 127.5).round) Image.write("img/img_#{i}.jpg", img) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-dnn-0.14.3 | examples/dcgan/imgen.rb |
ruby-dnn-0.14.2 | examples/dcgan/imgen.rb |
ruby-dnn-0.14.1 | examples/dcgan/imgen.rb |
ruby-dnn-0.14.0 | examples/dcgan/imgen.rb |