<jupyter_start><jupyter_text>Conditional DCGAN  Imports<jupyter_code>import os, time, random,itertools
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from sklearn.utils import shuffle
import pdb
from google.colab import files
import warnings
warnings.filterwarnings("ignore")<jupyter_output><empty_output><jupyter_text>Load data<jupyter_code>tf.reset_default_graph()
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=[])
X_train, y_train_cgan           = mnist.train.images, mnist.train.labels

x_train = (X_train - 0.5) / 0.5  



mnist_classifier = input_data.read_data_sets("MNIST_data/", reshape=False)
X_train, y_train           = mnist_classifier.train.images, mnist_classifier.train.labels
X_validation, y_validation = mnist_classifier.validation.images, mnist_classifier.validation.labels
X_test, y_test             = mnist_classifier.test.images, mnist_classifier.test.labels

 

IMAGE_SIZE = 28
onehot = np.eye(10)

def leaky_relu(X, leak=0.2):
    f1 = 0.5 * (1 + leak)
    f2 = 0.5 * (1 - leak)
    return f1 * X + f2 * tf.abs(X)<jupyter_output>WARNING:tensorflow:From <ipython-input-2-23de801d9e27>:4: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please write your own downloading logic.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-images-idx3-ubyte.gz
[...]<jupyter_text>Classifier<jupyter_code>#Classifier parameters
EPOCHS = 80
BATCH_SIZE = 100
Rate_C = 0.005

#Placeholder
x_Classfier = tf.placeholder(tf.float32, (None, 32, 32, 1))
y_Classfier = tf.placeholder(tf.int32, (None))
one_hot_y_Classfier = tf.one_hot(y_Classfier, 10)

#zero padding
X_train      = np.pad(X_train, ((0,0),(2,2),(2,2),(0,0)), 'constant')
X_validation = np.pad(X_validation, ((0,0),(2,2),(2,2),(0,0)), 'constant')
X_test       = np.pad(X_test, ((0,0),(2,2),(2,2),(0,0)), 'constant')

#classifier network
from tensorflow.contrib.layers import flatten

def LeNet(x):    
    # Hyperparameters
    mu = 0
    sigma = 0.1
    
    # Layer 1: Convolutional. Input = 32x32x1. Output = 28x28x6.
    # Input: BATCH_SIZEx32x32x1
    conv1_w = tf.Variable(tf.truncated_normal(shape = [5,5,1,6], mean = mu, stddev = sigma))
    conv1_b = tf.Variable(tf.zeros(6))
    conv1 = tf.nn.conv2d(x, conv1_w, strides = [1,1,1,1], padding = 'VALID') + conv1_b 
    
    # Activation. max(0,conv1)
    conv1 = tf.nn.relu(conv1)

    # Pooling. Input = 28x28x6. Output = 14x14x6.
    # [Batch,Height,Width,Depth]
    pool_1 = tf.nn.max_pool(conv1,ksize = [1,2,2,1], strides = [1,2,2,1], padding = 'VALID')
    
    # Layer 2: Convolutional. Output = 10x10x16.
    conv2_w = tf.Variable(tf.truncated_normal(shape = [5,5,6,16], mean = mu, stddev = sigma))
    conv2_b = tf.Variable(tf.zeros(16))
    conv2 = tf.nn.conv2d(pool_1, conv2_w, strides = [1,1,1,1], padding = 'VALID') + conv2_b
    
    # Activation.
    conv2 = tf.nn.relu(conv2)

    # Pooling. Input = 10x10x16. Output = 5x5x16.
    pool_2 = tf.nn.max_pool(conv2, ksize = [1,2,2,1], strides = [1,2,2,1], padding = 'VALID') 
    
    # Flatten. Input = 5x5x16. Output = 400.
    fc1 = flatten(pool_2)
    
    # Layer 3: Fully Connected. Input = 400. Output = 120.
    fc1_w = tf.Variable(tf.truncated_normal(shape = (400,120), mean = mu, stddev = sigma))
    fc1_b = tf.Variable(tf.zeros(120))
    fc1 = tf.matmul(fc1,fc1_w) + fc1_b
    
    # Activation.
    fc1 = tf.nn.relu(fc1)

    # Layer 4: Fully Connected. Input = 120. Output = 84.
    fc2_w = tf.Variable(tf.truncated_normal(shape = (120,84), mean = mu, stddev = sigma))
    fc2_b = tf.Variable(tf.zeros(84))
    fc2 = tf.matmul(fc1,fc2_w) + fc2_b
    
    # Activation.
    fc2 = tf.nn.relu(fc2)
    
    # Layer 5: Fully Connected. Input = 84. Output = 10.
    fc3_w = tf.Variable(tf.truncated_normal(shape = (84,10), mean = mu , stddev = sigma))
    fc3_b = tf.Variable(tf.zeros(10))
    logits = tf.matmul(fc2, fc3_w) + fc3_b
    return logits
  
# Loss function
logits = LeNet(x_Classfier)
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=one_hot_y_Classfier, logits=logits)  
loss_operation = tf.reduce_mean(cross_entropy)
optimizer = tf.train.AdamOptimizer(learning_rate=Rate_C)
# AdagradOptimizer, or MomentumOptimizer
#optimizer = tf.train.GradientDescentOptimizer(learning_rate=rate)
training_operation = optimizer.minimize(loss_operation)<jupyter_output>WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py:1624: flatten (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.flatten instead.
WARNING:tensorflow:From <ipython-input-3-caea599f7e14>:74: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See `tf.nn.softmax_cross_entropy_with_logits_v2`.<jupyter_text>Function to evaluate the model<jupyter_code>predictions_operation = tf.argmax(tf.nn.softmax(logits), 1)
correct_prediction = tf.equal(predictions_operation, tf.argmax(one_hot_y_Classfier, 1))
accuracy_operation = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
saver = tf.train.Saver()

def evaluate(X_data, y_data):
    num_examples = len(X_data)
    total_accuracy = 0
    sess = tf.get_default_session()
    all_predictions = []
    # i = 0:BATCH_SIZE:num_examples
    for offset in range(0, num_examples, BATCH_SIZE):
        batch_x, batch_y = X_data[offset:offset+BATCH_SIZE], y_data[offset:offset+BATCH_SIZE]
        accuracy, predictions = sess.run([accuracy_operation, predictions_operation], feed_dict={x_Classfier: batch_x, y_Classfier: batch_y})
        
        all_predictions = np.hstack((all_predictions, predictions))
        total_accuracy += (accuracy * len(batch_x))
    all_predictions = np.array(all_predictions)
    return total_accuracy / num_examples, all_predictions<jupyter_output><empty_output><jupyter_text>Placeholder<jupyter_code>x = tf.placeholder(tf.float32, shape=(None, IMAGE_SIZE, IMAGE_SIZE, 1))
noise = tf.placeholder(tf.float32, shape=(None, 1, 1, 100))
labels = tf.placeholder(tf.float32, shape=(None, 1, 1, 10))
real = tf.placeholder(tf.float32, shape=(None, IMAGE_SIZE, IMAGE_SIZE, 10))
Training = tf.placeholder(dtype=tf.bool)
keep_prob = tf.placeholder(dtype=tf.float32, name='keep_prob')<jupyter_output><empty_output><jupyter_text>Generator<jupyter_code>def Generator(x, labels,keep_prob=keep_prob, Training=True, reuse=False):
    with tf.variable_scope('Generator', reuse=reuse):
        W = tf.truncated_normal_initializer(mean=0.0, stddev=0.02)
        b = tf.constant_initializer(0.0)

        concat = tf.concat([x, labels], 3)

        out_1 = tf.layers.conv2d_transpose(concat, 256, [7, 7], strides=(1, 1), padding='valid', kernel_initializer=W, bias_initializer=b)
        out_1 = tf.layers.dropout(out_1, keep_prob)
        out_1 = tf.layers.batch_normalization(out_1, training=Training)#batch norm
        out_1 = leaky_relu(out_1, 0.2)

        out_2 = tf.layers.conv2d_transpose(out_1, 128, [5, 5], strides=(2, 2), padding='same', kernel_initializer=W, bias_initializer=b)
        out_2 = tf.layers.dropout(out_2, keep_prob)
        out_2 = tf.layers.batch_normalization(out_2, training=Training)#batch norm
        out_2 = leaky_relu(out_2, 0.2)

        out_3 = tf.layers.conv2d_transpose(out_2, 1, [5, 5], strides=(2, 2), padding='same', kernel_initializer=W, bias_initializer=b)
        out_3 = tf.nn.tanh(out_3)
        return out_3<jupyter_output><empty_output><jupyter_text>Discriminator<jupyter_code>def Discriminator(x, real,keep_prob=keep_prob, Training=True, reuse=False):
    with tf.variable_scope('Discriminator', reuse=reuse):

        W = tf.truncated_normal_initializer(mean=0.0, stddev=0.02)
        b = tf.constant_initializer(0.0)

        concat = tf.concat([x, real], 3)

        out_1 = tf.layers.conv2d(concat, 128, [5, 5], strides=(2, 2), padding='same', kernel_initializer=W, bias_initializer=b)
        out_1 = tf.layers.dropout(out_1, keep_prob)
        out_1 = tf.layers.batch_normalization(out_1, training=Training)#batch norm
        out_1 = leaky_relu(out_1, 0.2)

        out_2 = tf.layers.conv2d(out_1, 256, [5, 5], strides=(2, 2), padding='same', kernel_initializer=W, bias_initializer=b)
        out_2 = tf.layers.dropout(out_2, keep_prob)
        out_2 = tf.layers.batch_normalization(out_2, training=Training)#batch norm
        out_2 = leaky_relu(out_2, 0.2)

        out_3 = tf.layers.conv2d(out_2, 1, [7, 7], strides=(1, 1), padding='valid', kernel_initializer=W, bias_initializer=b)
        logits = tf.nn.sigmoid(out_3)
        return logits, out_3<jupyter_output><empty_output><jupyter_text>Parameters<jupyter_code>EPOCH = 20
BATCH_SIZE = 200
keep_prob_train = 0.6
BETA1 = 0.5
lr = 0.0002
label_smooth = 1<jupyter_output><empty_output><jupyter_text>Loss function<jupyter_code># Generate images
G_noise = Generator(noise, labels, Training)
# D
D_real, D_real_logits = Discriminator(x, real, Training)
D_fake, D_fake_logits = Discriminator(G_noise, real, Training, reuse=True)
# D real loss
Dis_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=D_real_logits, labels=tf.multiply(tf.ones_like(D_real_logits), (label_smooth))))
# D generated image loss
Dis_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=D_fake_logits, labels=tf.zeros([BATCH_SIZE, 1, 1, 1])))
# D total loss
Dis_loss = (Dis_loss_real + Dis_loss_fake) 
# G loss
Gen_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=D_fake_logits, labels=tf.ones([BATCH_SIZE, 1, 1, 1])))
# get all variables
tf_vars = tf.trainable_variables()
Dis_vars = [var for var in tf_vars if var.name.startswith('Discriminator')]
Gen_vars = [var for var in tf_vars if var.name.startswith('Generator')]
# optimise
with tf.control_dependencies(tf.get_collection(tf.GraphKeys.UPDATE_OPS)):
    D_optim =tf.train.AdamOptimizer(lr, beta1=BETA1).minimize(Dis_loss, var_list=Dis_vars)
    G_optim = tf.train.AdamOptimizer(lr, beta1=BETA1).minimize(Gen_loss, var_list=Gen_vars)<jupyter_output>WARNING:tensorflow:From <ipython-input-6-9689b1585b3f>:8: conv2d_transpose (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.conv2d_transpose instead.
WARNING:tensorflow:From <ipython-input-6-9689b1585b3f>:9: dropout (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dropout instead.
WARNING:tensorflow:From <ipython-input-6-9689b1585b3f>:10: batch_normalization (from tensorflow.python.layers.normalization) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.batch_normalization instead.
WARNING:tensorflow:From <ipython-input-7-6314a7bdda3e>:9: conv2d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.conv2d instead.<jupyter_text>Training<jupyter_code>saver = tf.train.Saver()
  
num_examples = len(x_train) 
k = num_examples % BATCH_SIZE
num_examples_gan = num_examples - k

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
                          
    print("Training CDCGAN")    
    for i in range(EPOCH):  
        start = time.time()        
        x_train, y_train_cgan = shuffle(x_train, y_train_cgan)    
        for offset in range(0, num_examples_gan, BATCH_SIZE):
            train_d = True
            train_g = True                        
            end = offset + BATCH_SIZE
            batch_x = x_train[offset:end] 
            batch_y = y_train_cgan[offset:end] 
            
            label_ = batch_y.reshape([BATCH_SIZE, 1, 1, 10])
            real_ = label_ * np.ones([BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 10])
            noise_ = np.random.normal(0, 1, (BATCH_SIZE, 1, 1, 100))
                        
            #calculate loss
            d_ls = sess.run(Dis_loss,{noise: noise_, x: batch_x, real: real_, labels: label_, Training: False})
            g_ls = sess.run(Gen_loss,{noise: noise_, x: batch_x, real: real_, labels: label_, Training: False})
                                    
            
            if g_ls * 2 < d_ls:
                train_g = False
                pass
            if d_ls * 2 < g_ls:
                train_d = False
                pass
            
            #Update D 
            if train_d:
                sess.run(D_optim, {x: batch_x, noise: noise_,keep_prob: keep_prob_train,real: real_, labels: label_,Training: True})
            
            #Update G
            if train_g:
                sess.run(G_optim, {noise: noise_, x:batch_x,keep_prob: keep_prob_train,real: real_, labels: label_, Training: True})
                
                       
        end = time.time()
        elapsed = end - start    
        #break
        if ((i+1)%2 == 0)or(i==0):
            print("EPOCH {} ...".format(i+1))
            print("G_loss = {:.3f}  D_loss = {:.3f}   Tme used = {:.3f}".format(g_ls, d_ls,elapsed))
            print()     

            
    saver.save(sess, './lenet')
    print("Model saved")<jupyter_output>Training CDCGAN
EPOCH 1 ...
G_loss = 0.802  D_loss = 1.032   Tme used = 96.708

EPOCH 2 ...
G_loss = 2.197  D_loss = 1.044   Tme used = 98.684

EPOCH 4 ...
G_loss = 0.912  D_loss = 0.966   Tme used = 85.878

EPOCH 6 ...
G_loss = 0.609  D_loss = 1.154   Tme used = 106.106

EPOCH 8 ...
G_loss = 0.803  D_loss = 1.097   Tme used = 105.212

EPOCH 10 ...
G_loss = 1.165  D_loss = 1.092   Tme used = 104.142

EPOCH 12 ...
G_loss = 1.148  D_loss = 1.055   Tme used = 103.514

EPOCH 14 ...
G_loss = 1.177  D_loss = 0.995   Tme used = 103.850

EPOCH 16 ...
G_loss = 1.301  D_loss = 0.987   Tme used = 104.297

EPOCH 18 ...
G_loss = 0.978  D_loss = 0.994   Tme used = 105.428

EPOCH 20 ...
G_loss = 1.721  D_loss = 1.133   Tme used = 105.105

Model saved<jupyter_text>Mix real and fake image如果要改变real和fake的比例，不用重新跑CGAN，只需改变下面第二行portion的值。然后重新运行下面2个block，就可以得出新比例下的testing set accuracyreal image的数量是固定的：1000张。唯一的变量是portion。例如portion=0.1，那么混合的图片中有100张fake，1000张real，一共1100张。<jupyter_code>#Portions of the synthetic images
portion = 15

X_train, y_train = shuffle(X_train, y_train)

X_real = X_train[0:1000,:,:,:]
y_real = y_train[0:1000]

n_real = len(X_real)

#initialization
n_total = int(n_real*(1+portion))


#Generate images
n_sample = int(portion*n_real/10)
y_generated = np.zeros(shape=[10*n_sample,1,1,10])
y_ = np.zeros(shape=[10*n_sample])

for i in range(10):   
    y_generated[n_sample*i:n_sample*(i+1),:,:, i] = 1
    y_[n_sample*i:n_sample*(i+1)] = i


n_generated = 0 
x_fake = np.zeros(shape=[n_total,32,32,1])
y_fake = np.zeros(shape=[n_total])

with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('.'))
    num_examples = len(X_train)   
    print("Training...")
    print()
    for i in range(20):
        X_train, y_train = shuffle(X_train, y_train)
         
        for offset in range(0, num_examples, BATCH_SIZE):
            end = offset + BATCH_SIZE
            batch_x, batch_y = X_train[offset:end], y_train[offset:end]
            sess.run(training_operation, feed_dict={x_Classfier: batch_x, y_Classfier: batch_y})
            
        validation_accuracy, validation_predictions = evaluate(X_validation, y_validation)
        if ((i+1)%10 == 0)or(i==0):
            print("EPOCH {} ...".format(i+1))
            print("Validation Accuracy = {:.3f}".format(validation_accuracy))
            print()
        
    n =  np.random.normal(0, 1, (10*n_sample, 1, 1, 100))
    samples = sess.run(G_noise, feed_dict={noise:n, labels:y_generated, Training:False})   
    samples = samples*2 + 0.5
    x_ = np.pad(samples, ((0,0),(2,2),(2,2),(0,0)), 'constant')
    
    
    for i in range(len(x_)):
        l = sess.run(logits,feed_dict={x_Classfier: x_[i:i+1,:,:,:]})
        l = np.exp(l)
        l = l / np.sum(l)
        maximum = np.max(l)
        if (maximum > 0.9999):
            x_fake[n_generated:n_generated+1,:,:,:] = x_[i:i+1,:,:,:]
            y_fake[n_generated] = y_[i]
            n_generated = n_generated + 1
        

x_FAKE = x_fake[0:n_generated,:,:,:]
y_FAKE = y_fake[0:n_generated]


n_total = int(n_real+n_generated)
X_mix = np.zeros(shape=[n_total,32,32,1])
Y_mix = np.zeros(shape=[n_total])

#mix real and fake images
X_mix[0:n_generated,:,:,:] = x_FAKE
X_mix[n_generated:n_total,:,:,:] = X_real
Y_mix[0:n_generated] = y_FAKE
Y_mix[n_generated:n_total] = y_real

print("Number of the mixed images: {}".format(len(X_mix)))
print("Number of the real images:  {}".format(len(X_real)))
print("Number of the fake images:  {}".format(len(x_FAKE)))<jupyter_output>INFO:tensorflow:Restoring parameters from ./lenet
Training...

EPOCH 1 ...
Validation Accuracy = 0.976

EPOCH 10 ...
Validation Accuracy = 0.989

EPOCH 20 ...
Validation Accuracy = 0.990

Number of the mixed images: 8770
Number of the real images:  1000
Number of the fake images:  7770<jupyter_text>Re-Trianing Classisifer<jupyter_code>with tf.Session() as sess:
    sess.run(tf.global_variables_initializer()) 
    print("Training Classifier")  
               
    num_examples = len(X_mix) 
    for i in range(80):
        X_mix, Y_mix = shuffle(X_mix, Y_mix)
         
        for offset in range(0, num_examples, BATCH_SIZE):
            end = offset + BATCH_SIZE
            batch_x, batch_y = X_mix[offset:end], Y_mix[offset:end]
            sess.run(training_operation, feed_dict={x_Classfier: batch_x, y_Classfier: batch_y})
            
        validation_accuracy, _ = evaluate(X_validation, y_validation)
        if ((i+1)%10 == 0)or(i==0):
            print("EPOCH {} ...".format(i+1))
            print("Testing Accuracy = {:.3f}".format(validation_accuracy))
            print()           
            
    test_accuracy, test_predictions = evaluate(X_test, y_test)
    print("Test Accuracy = {:.3f}".format(test_accuracy))<jupyter_output>Training Classifier
EPOCH 1 ...
Testing Accuracy = 0.901

EPOCH 10 ...
Testing Accuracy = 0.945

EPOCH 20 ...
Testing Accuracy = 0.963

EPOCH 30 ...
Testing Accuracy = 0.959

EPOCH 40 ...
Testing Accuracy = 0.968

EPOCH 50 ...
Testing Accuracy = 0.969

EPOCH 60 ...
Testing Accuracy = 0.968

EPOCH 70 ...
Testing Accuracy = 0.969

EPOCH 80 ...
Testing Accuracy = 0.969

Test Accuracy = 0.969<jupyter_text>Visualization<jupyter_code>def show_result(test_images, show = True, save = False):
    size_figure_grid = 10
    fig, ax = plt.subplots(size_figure_grid, size_figure_grid, figsize=(5, 5))
    for i, j in itertools.product(range(size_figure_grid), range(size_figure_grid)):
        ax[i, j].get_xaxis().set_visible(False)
        ax[i, j].get_yaxis().set_visible(False)
    for k in range(10*10):
        i = k // 10
        j = k % 10
        ax[i, j].cla()
        ax[i, j].imshow(np.reshape(test_images[k], (IMAGE_SIZE, IMAGE_SIZE)), cmap='gray')
        
    if show:
        plt.show()
    else:
        plt.close()
    if save:    
        fig.savefig('G images.png', dpi=600)
        files.download('G images.png')
        
        
noise_ = np.random.normal(0, 1, (100, 1, 1, 100))
fixed_label_ = np.zeros((10, 1))

for i in range(9):
    temp = np.ones((10, 1)) + i
    fixed_label_ = np.concatenate([fixed_label_, temp], 0)
fixed_label_ = onehot[fixed_label_.astype(np.int32)].reshape((100, 1, 1, 10))


with tf.Session() as sess:
    saver.restore(sess, tf.train.latest_checkpoint('.'))    
    test_images = sess.run(G_noise, {noise: noise_, labels: fixed_label_, Training: False})


show_result(test_images)<jupyter_output>INFO:tensorflow:Restoring parameters from ./lenet
{'fraction_non_alphanumeric': 0.12783426416535396, 'fraction_numerical': 0.04391617738316865, 'mean_word_length': 3.6094609460946097, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '66502', 'license': 'MIT', 'n_tokens_mistral': 8479, 'n_tokens_neox': 7761, 'n_words': 1537, 'path': 'CGAN_confidence_score.ipynb', 'repo_name': 'SnowzTail/generate-synthetic-handwritten-digit-images-by-gan', 'size': '20949'}