Sha256: 023d64930e3c26cfabdbedc1556351846fc5063bcedc84ff2e6c2edbab88046e
Contents?: true
Size: 474 Bytes
Versions: 5
Compression:
Stored size: 474 Bytes
Contents
require "dnn" require "dnn/image" require "numo/linalg/autoloader" require_relative "dcgan" Image = DNN::Image batch_size = 100 dcgan = DCGAN.load("trained/dcgan_model_epoch20.marshal") gen = dcgan.gen 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
5 entries across 5 versions & 1 rubygems