-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils_.py
53 lines (40 loc) · 1.24 KB
/
utils_.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
import os
import csv
import numpy
from sklearn import preprocessing
import urllib
pp = pprint.PrettyPrinter()
get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shape()[-1])
def load_data(path,type_,size,dataset): # loading the data
reg = np.random.rand(400, 35, 35) # here put view1
mal = np.random.rand(400, 35, 35) # here put view 2
data = np.zeros((reg.shape[0], reg.shape[1], reg.shape[2], 2))
for i in range(reg.shape[0]):
data[i, :, :, 0] = reg[i]
data[i, :, :, 1] = mal[i]
return data
def load_data1(size,dataset):
reg = np.random.rand(400, 35, 35)
data = np.zeros((reg.shape[0], reg.shape[1], reg.shape[2], 2))
for i in range(reg.shape[0]):
data[i, :, :, 0] = reg[i]
data[i, :, :, 1] = reg[i]
return data
def load_data_test(size,dataset):
reg = np.load('./Vtest1.npy')
data = np.zeros((reg.shape[0],reg.shape[1],reg.shape[2],2))
for i in range(reg.shape[0]):
data[i,:,:,0]=reg[i]
data[i,:,:,1]=reg[i]
return data