This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ported from https://github.com/pvigier/perlin-numpy/blob/master/perlin2d.py | |
import torch | |
import math | |
def rand_perlin_2d(shape, res, fade = lambda t: 6*t**5 - 15*t**4 + 10*t**3): | |
delta = (res[0] / shape[0], res[1] / shape[1]) | |
d = (shape[0] // res[0], shape[1] // res[1]) | |
grid = torch.stack(torch.meshgrid(torch.arange(0, res[0], delta[0]), torch.arange(0, res[1], delta[1])), dim = -1) % 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
// | |
// This program contains an implementation of SSIM-based perceptual image | |
// downscaling for PNG images. | |
// The program can be twice as fast when compiled with -Ofast. | |
// The program behaviour can be adjusted with predefined preprocessor macros: | |
// * -DTILEABLE: Assume images wrap around at corners. This should be enabled | |
// when downscaling tileable textures. | |
// * -DGAMMA_INCORRECT: Downscale without applying the sRGB EOTF and OETF. | |
// When downscaling images with symbolic meaning, e.g. screenshots of text or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{0: 'tench, Tinca tinca', | |
1: 'goldfish, Carassius auratus', | |
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
3: 'tiger shark, Galeocerdo cuvieri', | |
4: 'hammerhead, hammerhead shark', | |
5: 'electric ray, crampfish, numbfish, torpedo', | |
6: 'stingray', | |
7: 'cock', | |
8: 'hen', | |
9: 'ostrich, Struthio camelus', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeDescriptors(net) | |
for i,val in pairs(net.modules) do | |
if tostring(val):find('cudnn') then | |
for name,field in pairs(val) do | |
if name:find('Desc') then | |
val[name] = nil | |
end | |
end | |
val.algType = nil | |
val.iDesc = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local LReLU, parent = torch.class('nn.LReLU','nn.Module') | |
function LReLU:__init(a) | |
parent.__init(self) | |
self.a = a or 0.1 | |
self.ReLU_p = nn.ReLU() | |
end | |
function LReLU:updateOutput(input) | |
self.output:resizeAs(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option value="1">Hokkaido</option> | |
<option value="2">Aomori</option> | |
<option value="3">Iwate</option> | |
<option value="4">Miyagi</option> | |
<option value="5">Akita</option> | |
<option value="6">Yamagata</option> | |
<option value="7">Fukushima</option> | |
<option value="8">Ibaraki</option> | |
<option value="9">Tochigi</option> |