repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/mnist.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/mnist.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targets = targets[targets!=bias]...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/__init__.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/__init__.py
import numpy as np import tensorflow as tf #import locale #locale.setlocale(locale.LC_ALL, '') _params = {} _param_aliases = {} def param(name, *args, **kwargs): """ A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Va...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/lsun.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/lsun.py
import numpy as np import scipy.misc import time import cv2 from os import listdir def make_generator(path, n_files, batch_size, image_size): epoch_count = [1] images_name = listdir(path) if n_files == 0: n_files = len(images_name) else: n_files = n_files def get_epoch(): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/save_images.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/save_images.py
""" Image grid saver, based on color_grid_vis from github.com/Newmu """ import numpy as np import scipy.misc from scipy.misc import imsave def save_images(X, save_path): # [0, 1] -> [0,255] if isinstance(X.flatten()[0], np.floating): X = (255.99*X).astype('uint8') n_samples = X.shape[0] rows ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/mnist_mask_digit.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/mnist_mask_digit.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None): images, targets = data # if selecting_label is None: # rng_state = numpy.random.get_state() # numpy.random.shuffle(images) ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/layernorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/layernorm.py
import tflib as lib import numpy as np import tensorflow as tf def Layernorm(name, norm_axes, inputs): mean, var = tf.nn.moments(inputs, norm_axes, keep_dims=True) # Assume the 'neurons' axis is the first of norm_axes. This is the case for fully-connected and BCHW conv layers. n_neurons = inputs.get_shap...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/deconv2d.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/deconv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/__init__.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/__init__.py
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/conv1d.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/conv1d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def Conv1D(name, input_dim, output_dim, filter_size, inputs, he_init=True, mask_type=None, stride=1, weightnorm=None, biases=True, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/conv2d.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/conv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/batchnorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True): if ((axes == [0,2,3]) or (axes == [0,2])) and fused==True: if axes==[0,2]: inputs = tf.expand_dims(inputs, 3) # Old...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/cond_batchnorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/cond_batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True, labels=None, n_labels=None): """conditional batchnorm (dumoulin et al 2016) for BCHW conv filtermaps""" if axes != [0,2,3]: raise Ex...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/linear.py
MNISTtf/MNISTtf_old/conditional_one_hot/miner/tflib/ops/linear.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def disable_default_weightnorm(): global _default_weightnorm _default_weightnorm = False _weights_stdev = None def set_wei...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/teacher_output_d.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/teacher_output_d.py
import os, sys sys.path.append(os.getcwd()) import numpy as np import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d import tflib.save_images import tflib.mnist import tflib.plot import pdb def teacher_model(noise, fake_dat...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_super_g_d_two_class_unbalance_one_D.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_super_g_d_two_class_unbalance_one_D.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d i...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/teacher.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/teacher.py
import os, sys sys.path.append(os.getcwd()) import numpy as np import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d import tflib.save_images import tflib.mnist import tflib.plot import pdb def teacher_model(noise, fake_data...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_mnist_knowledge_distillation_adaptor_step1.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_mnist_knowledge_distillation_adaptor_step1.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d i...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/mnist.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/mnist.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targets = targets[targets!=bias]...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_super_g_d_two_class_unbalance_one_D_no_share_latent.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/cgan_super_g_d_two_class_unbalance_one_D_no_share_latent.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d i...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/lsun_label.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/lsun_label.py
from os import listdir import numpy as np import scipy.misc import time import pdb Label={'bedroom':0, 'kitchen':1, 'dining_room':2, 'conference_room':3, 'living_room':4, 'bridge':5, 'tower':6, 'classroom':7, 'church_outdoor':8, 'restaurant':9} def make_g...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/plot.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/plot.py
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import collections import time import cPickle as pickle _since_beginning = collections.defaultdict(lambda: {}) _since_last_flush = collections.defaultdict(lambda: {}) _iter = [0] def tick(): _iter[0] += 1 def plot(name, valu...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist_step1.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist_step1.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targets = targets[targets!=bias]...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targets = targets[targets!=bias]...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/__init__.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/__init__.py
import numpy as np import tensorflow as tf #import locale #locale.setlocale(locale.LC_ALL, '') _params = {} _param_aliases = {} def param(name, *args, **kwargs): """ A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Va...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/lsun.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/lsun.py
import numpy as np import scipy.misc import time import cv2 from os import listdir def make_generator(path, n_files, batch_size, image_size): epoch_count = [1] images_name = listdir(path) if n_files == 0: n_files = len(images_name) else: n_files = n_files def get_epoch(): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/save_images.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/save_images.py
""" Image grid saver, based on color_grid_vis from github.com/Newmu """ import numpy as np import scipy.misc from scipy.misc import imsave def save_images(X, save_path): # [0, 1] -> [0,255] if isinstance(X.flatten()[0], np.floating): X = (255.99*X).astype('uint8') n_samples = X.shape[0] rows ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist_mask_digit.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/mnist_mask_digit.py
import numpy import os import urllib import gzip import cPickle as pickle import pdb def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None): images, targets = data # if selecting_label is None: # rng_state = numpy.random.get_state() # numpy.random.shuffle(images) ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/layernorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/layernorm.py
import tflib as lib import numpy as np import tensorflow as tf def Layernorm(name, norm_axes, inputs): mean, var = tf.nn.moments(inputs, norm_axes, keep_dims=True) # Assume the 'neurons' axis is the first of norm_axes. This is the case for fully-connected and BCHW conv layers. n_neurons = inputs.get_shap...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/deconv2d.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/deconv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/__init__.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/__init__.py
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/conv1d.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/conv1d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def Conv1D(name, input_dim, output_dim, filter_size, inputs, he_init=True, mask_type=None, stride=1, weightnorm=None, biases=True, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/conv2d.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/conv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/batchnorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True): if ((axes == [0,2,3]) or (axes == [0,2])) and fused==True: if axes==[0,2]: inputs = tf.expand_dims(inputs, 3) # Old...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/cond_batchnorm.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/cond_batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True, labels=None, n_labels=None): """conditional batchnorm (dumoulin et al 2016) for BCHW conv filtermaps""" if axes != [0,2,3]: raise Ex...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/linear.py
MNISTtf/MNISTtf_old/conditional_one_hot/on_manifold/tflib/ops/linear.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def disable_default_weightnorm(): global _default_weightnorm _default_weightnorm = False _weights_stdev = None def set_wei...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/plot_loss.py
MNISTtf/off_manifold/plot_loss.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import tflib as lib import tflib.plot import pickle if(len(sys.argv)==1): sys.argv=[sys.argv[0],7,16] BIAS_DIGIT = int(sys.argv[1]) #default is 9 NOISE_LEN = int(...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2_eccv.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2_eccv.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'0,1,2,4,5,6,8,9','16','0','-1','3'] #sys.argv=[sys.argv[0],'3,7','16','0','.3,.7','3,7'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sy...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2_scratch.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2_scratch.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'0,1,2,4,5,6,8,9','16','0','-1','3'] #sys.argv=[sys.argv[0],'3,7','16','0','.3,.7','3,7'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sy...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step4.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step4.py
import os, sys sys.path.append(os.getcwd()) BIAS_DIGIT = int(sys.argv[1]) #default is 9 NOISE_LEN = int(sys.argv[2]) #default is 128 import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import tensorflow as tf import tflib as lib import tflib....
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step2.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'3,7','16','1','.3,.7','3,7'] #sys.argv=[sys.argv[0],'0,1,2,4,5,6,8,9','16','0','-1','3'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sy...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step1.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step1.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'7','16','1','-1'] #sys.argv=[sys.argv[0],'3,7','16','0','.3,.7','-1'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sys.argv[2]) #default...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step3.py
MNISTtf/off_manifold/gan_mnist_knowledge_distillation_adaptor_step3.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'0,1,2,4,5,6,8,9','16','0','-1','3'] #sys.argv=[sys.argv[0],'3,7','16','0','.3,.7','3,7'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sy...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/lsun_label.py
MNISTtf/off_manifold/tflib/lsun_label.py
from os import listdir import numpy as np import scipy.misc import time import pdb Label={'bedroom':0, 'kitchen':1, 'dining_room':2, 'conference_room':3, 'living_room':4, 'bridge':5, 'tower':6, 'classroom':7, 'church_outdoor':8, 'restaurant':9} def make_g...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/plot.py
MNISTtf/off_manifold/tflib/plot.py
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import collections import time #import cPickle as pickle import pickle _since_beginning = collections.defaultdict(lambda: {}) _since_last_flush = collections.defaultdict(lambda: {}) _iter = [0] def tick(): _iter[0] += 1 def ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/mnist_allsteps.py
MNISTtf/off_manifold/tflib/mnist_allsteps.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import math def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None, portion = 1): images, targets = data if bias is not None : images = images[targets!=bias] ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/mnist_step1.py
MNISTtf/off_manifold/tflib/mnist_step1.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import math def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targe...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/mnist_original.py
MNISTtf/off_manifold/tflib/mnist_original.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import math def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None): images, targets = data if bias is not None : images = images[targets!=bias] targe...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/mnist_step2.py
MNISTtf/off_manifold/tflib/mnist_step2.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import os from scipy.misc import imsave def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None): images, targets = data #for index, i in enumerate(targets): # if not os.path...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/mnist.py
MNISTtf/off_manifold/tflib/mnist.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import math import numpy as np def rounddown(x): return int(math.floor(x / 100.0)) * 100 def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None, portions = None): im...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/__init__.py
MNISTtf/off_manifold/tflib/__init__.py
import numpy as np import tensorflow as tf #import locale #locale.setlocale(locale.LC_ALL, '') _params = {} _param_aliases = {} def param(name, *args, **kwargs): """ A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Va...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/lsun.py
MNISTtf/off_manifold/tflib/lsun.py
import numpy as np import scipy.misc import time import cv2 from os import listdir def make_generator(path, n_files, batch_size, image_size): epoch_count = [1] images_name = listdir(path) if n_files == 0: n_files = len(images_name) else: n_files = n_files def get_epoch(): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/save_images.py
MNISTtf/off_manifold/tflib/save_images.py
""" Image grid saver, based on color_grid_vis from github.com/Newmu """ import numpy as np import scipy.misc from scipy.misc import imsave def save_images(X, save_path): # [0, 1] -> [0,255] if isinstance(X.flatten()[0], np.floating): X = (255.99*X).astype('uint8') n_samples = X.shape[0] rows ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/layernorm.py
MNISTtf/off_manifold/tflib/ops/layernorm.py
import tflib as lib import numpy as np import tensorflow as tf def Layernorm(name, norm_axes, inputs): mean, var = tf.nn.moments(inputs, norm_axes, keep_dims=True) # Assume the 'neurons' axis is the first of norm_axes. This is the case for fully-connected and BCHW conv layers. n_neurons = inputs.get_shap...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/deconv2d.py
MNISTtf/off_manifold/tflib/ops/deconv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/__init__.py
MNISTtf/off_manifold/tflib/ops/__init__.py
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/conv1d.py
MNISTtf/off_manifold/tflib/ops/conv1d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def Conv1D(name, input_dim, output_dim, filter_size, inputs, he_init=True, mask_type=None, stride=1, weightnorm=None, biases=True, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/conv2d.py
MNISTtf/off_manifold/tflib/ops/conv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/batchnorm.py
MNISTtf/off_manifold/tflib/ops/batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True): if ((axes == [0,2,3]) or (axes == [0,2])) and fused==True: if axes==[0,2]: inputs = tf.expand_dims(inputs, 3) # Old...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/cond_batchnorm.py
MNISTtf/off_manifold/tflib/ops/cond_batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True, labels=None, n_labels=None): """conditional batchnorm (dumoulin et al 2016) for BCHW conv filtermaps""" if axes != [0,2,3]: raise Ex...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/off_manifold/tflib/ops/linear.py
MNISTtf/off_manifold/tflib/ops/linear.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def disable_default_weightnorm(): global _default_weightnorm _default_weightnorm = False _weights_stdev = None def set_wei...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/plot_loss.py
MNISTtf/on_manifold/plot_loss.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import tflib as lib import tflib.plot import pickle if(len(sys.argv)==1): sys.argv=[sys.argv[0],7,16] BIAS_DIGIT = int(sys.argv[1]) #default is 9 NOISE_LEN = int(...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step4.py
MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step4.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'3,7','16','0','.3,.7'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sys.argv[2]) #default is 128 if(len(sys.argv)>3): os.environ["CU...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step2.py
MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step2.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'3,7','16','0','.3,.7'] #3,7 16 1 .1,.9 if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sys.argv[2]) #default is 128 if(len(sys.argv)>3): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step1.py
MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step1.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'-1','16','0','-1'] if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sys.argv[2]) #default is 128 if(len(sys.argv)>3): os.environ["CUDA_D...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step3.py
MNISTtf/on_manifold/gan_mnist_knowledge_distillation_adaptor_step3.py
import os, sys import numpy as np sys.path.append(os.getcwd()) if(len(sys.argv)==1): sys.argv=[sys.argv[0],'3,7','16','0','.3,.7'] #3,7 16 1 .1,.9 if(len(sys.argv)>2): BIAS_DIGIT = np.array(sys.argv[1].split(',')).astype(int) #default is 9 NOISE_LEN = int(sys.argv[2]) #default is 128 if(len(sys.argv)>3): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/lsun_label.py
MNISTtf/on_manifold/tflib/lsun_label.py
from os import listdir import numpy as np import scipy.misc import time import pdb Label={'bedroom':0, 'kitchen':1, 'dining_room':2, 'conference_room':3, 'living_room':4, 'bridge':5, 'tower':6, 'classroom':7, 'church_outdoor':8, 'restaurant':9} def make_g...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/plot.py
MNISTtf/on_manifold/tflib/plot.py
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import collections import time import cPickle as pickle _since_beginning = collections.defaultdict(lambda: {}) _since_last_flush = collections.defaultdict(lambda: {}) _iter = [0] def tick(): _iter[0] += 1 def plot(name, valu...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/mnist.py
MNISTtf/on_manifold/tflib/mnist.py
import numpy import os import urllib import gzip #import cPickle as pickle import pickle import pdb import math import numpy as np def rounddown(x): return int(math.floor(x / 100.0)) * 100 def mnist_generator(data, batch_size, n_labelled, limit=None, selecting_label = None, bias = None, portions = None): im...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/__init__.py
MNISTtf/on_manifold/tflib/__init__.py
import numpy as np import tensorflow as tf #import locale #locale.setlocale(locale.LC_ALL, '') _params = {} _param_aliases = {} def param(name, *args, **kwargs): """ A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Va...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/lsun.py
MNISTtf/on_manifold/tflib/lsun.py
import numpy as np import scipy.misc import time import cv2 from os import listdir def make_generator(path, n_files, batch_size, image_size): epoch_count = [1] images_name = listdir(path) if n_files == 0: n_files = len(images_name) else: n_files = n_files def get_epoch(): ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/save_images.py
MNISTtf/on_manifold/tflib/save_images.py
""" Image grid saver, based on color_grid_vis from github.com/Newmu """ import numpy as np import scipy.misc from scipy.misc import imsave def save_images(X, save_path): # [0, 1] -> [0,255] if isinstance(X.flatten()[0], np.floating): X = (255.99*X).astype('uint8') n_samples = X.shape[0] rows ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/layernorm.py
MNISTtf/on_manifold/tflib/ops/layernorm.py
import tflib as lib import numpy as np import tensorflow as tf def Layernorm(name, norm_axes, inputs): mean, var = tf.nn.moments(inputs, norm_axes, keep_dims=True) # Assume the 'neurons' axis is the first of norm_axes. This is the case for fully-connected and BCHW conv layers. n_neurons = inputs.get_shap...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/deconv2d.py
MNISTtf/on_manifold/tflib/ops/deconv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/__init__.py
MNISTtf/on_manifold/tflib/ops/__init__.py
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/conv1d.py
MNISTtf/on_manifold/tflib/ops/conv1d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def Conv1D(name, input_dim, output_dim, filter_size, inputs, he_init=True, mask_type=None, stride=1, weightnorm=None, biases=True, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/conv2d.py
MNISTtf/on_manifold/tflib/ops/conv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/batchnorm.py
MNISTtf/on_manifold/tflib/ops/batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True): if ((axes == [0,2,3]) or (axes == [0,2])) and fused==True: if axes==[0,2]: inputs = tf.expand_dims(inputs, 3) # Old...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/cond_batchnorm.py
MNISTtf/on_manifold/tflib/ops/cond_batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True, labels=None, n_labels=None): """conditional batchnorm (dumoulin et al 2016) for BCHW conv filtermaps""" if axes != [0,2,3]: raise Ex...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/MNISTtf/on_manifold/tflib/ops/linear.py
MNISTtf/on_manifold/tflib/ops/linear.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def disable_default_weightnorm(): global _default_weightnorm _default_weightnorm = False _weights_stdev = None def set_wei...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/precompute_acts.py
styleGAN/precompute_acts.py
import argparse import pickle import random import numpy as np from tqdm import tqdm import torch from torchvision import transforms from dataset import MultiResolutionDataset from train import sample_data from metric.inception import InceptionV3 if __name__ == '__main__': parser = argparse.ArgumentParser(descript...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/train.py
styleGAN/train.py
import argparse import random import math from tqdm import tqdm import numpy as np from PIL import Image import torch from torch import nn, optim from torch.nn import functional as F from torch.autograd import Variable, grad from torch.utils.data import DataLoader from torchvision import datasets, transforms, utils ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/finetune.py
styleGAN/finetune.py
import os import argparse import pickle import math import random import numpy as np from tqdm import tqdm import torch from torch import nn, optim from torch.nn import functional as F from torch.autograd import grad from torchvision import transforms, utils from torch.utils.tensorboard import SummaryWriter from data...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/model.py
styleGAN/model.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F from torch.autograd import Function from math import sqrt import random import pdb def init_linear(linear): init.xavier_normal(linear.weight) linear.bias.data.zero_() def init_conv(conv, glu=True): init....
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/generate.py
styleGAN/generate.py
import argparse import math import torch from torchvision import utils from model import StyledGenerator @torch.no_grad() def get_mean_style(generator, device): mean_style = None for i in range(10): style = generator.mean_style(torch.randn(1024, 512).to(device)) if mean_style is None: ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/dataset.py
styleGAN/dataset.py
from io import BytesIO import lmdb from PIL import Image from torch.utils.data import Dataset class MultiResolutionDataset(Dataset): def __init__(self, path, transform, resolution=8): self.env = lmdb.open( path, max_readers=32, readonly=True, lock=False, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/test.py
styleGAN/test.py
import os import argparse import pickle import math import random import numpy as np from tqdm import tqdm import torch from torch import nn, optim from torch.nn import functional as F from torch.autograd import grad from torchvision import transforms, utils from torch.utils.tensorboard import SummaryWriter from data...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/prepare_data.py
styleGAN/prepare_data.py
import argparse from io import BytesIO import multiprocessing from functools import partial from PIL import Image import lmdb from tqdm import tqdm from torchvision import datasets from torchvision.transforms import functional as trans_fn import pdb def resize_and_convert(img, size, quality=100): img = trans_fn....
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/loss/AdaBIGGANLoss.py
styleGAN/loss/AdaBIGGANLoss.py
import torch import torchvision import torch.nn as nn import torch.nn.functional as F from .Vgg16PerceptualLoss import Vgg16PerceptualLoss class AdaBIGGANLoss(nn.Module): def __init__(self,perceptual_loss = "vgg", scale_per=0.001, scale_emd=0.1, scale_reg=0.02, ...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/loss/Vgg16PerceptualLoss.py
styleGAN/loss/Vgg16PerceptualLoss.py
import torch from torchvision import models import torch.nn.functional as F class Vgg16PerceptualLoss(torch.nn.Module): def __init__(self, perceptual_indices = [1,3,6,8,11,13,15,18,20,22] ,loss_func="l1",requires_grad = False): ''' perceptual_indices: indices to use for perceptural loss los...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/loss/__init__.py
styleGAN/loss/__init__.py
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/metric/inception.py
styleGAN/metric/inception.py
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models try: from torchvision.models.utils import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url # Inception weights ported to Pytorch from # http://do...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/metric/fid_score.py
styleGAN/metric/fid_score.py
#!/usr/bin/env python3 """Calculates the Frechet Inception Distance (FID) to evalulate GANs The FID metric calculates the distance between two distributions of images. Typically, we have summary statistics (mean & covariance matrix) of one of these distributions, while the 2nd distribution is given by a GAN. When run a...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/metric/metric.py
styleGAN/metric/metric.py
import time import functools import numpy as np from tqdm import tqdm import torch from torch.utils.data import TensorDataset, DataLoader from .fid_score import calculate_frechet_distance # from .kid_score import polynomial_mmd_averages from .swd_score import calculate_swd def get_fake_images_and_acts(inception, g_...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/metric/swd_score.py
styleGAN/metric/swd_score.py
# https://github.com/koshian2/swd-pytorch/blob/master/swd.py from PIL import Image import math import numpy as np import torch import torch.nn.functional as F import torchvision # Gaussian blur kernel def get_gaussian_kernel(device="cpu"): kernel = np.array([ [1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/styleGAN/metric/kid_score.py
styleGAN/metric/kid_score.py
# https://github.com/mbinkowski/MMD-GAN/blob/master/gan/compute_scores.py """Calculates the Kernel Inception Distance (KID) to evalulate GANs """ import os import sys import numpy as np from sklearn.metrics.pairwise import polynomial_kernel def polynomial_mmd_averages(codes_r, codes_g, n_subsets=100, subset_size=1000...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/batchnorm_reimpl.py
sync_batchnorm/batchnorm_reimpl.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : batchnorm_reimpl.py # Author : acgtyrant # Date : 11/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import torch import torch.nn as nn import torch...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/replicate.py
sync_batchnorm/replicate.py
# -*- coding: utf-8 -*- # File : replicate.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import functools from torch.nn.parallel.da...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/unittest.py
sync_batchnorm/unittest.py
# -*- coding: utf-8 -*- # File : unittest.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import unittest import torch class TorchTes...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/comm.py
sync_batchnorm/comm.py
# -*- coding: utf-8 -*- # File : comm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import queue import collections import threading...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/__init__.py
sync_batchnorm/__init__.py
# -*- coding: utf-8 -*- # File : __init__.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. from .batchnorm import SynchronizedBatchNorm...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false