Exemple #1
0
# compare classes
#class_names = cifar10.load_class_names()
#my_class_names = ["0","1","2","3","4","5","6","7","8","9"]
num_classes = 10
print num_classes
#print ("class name type: ",type(my_class_names[0]))
#print("hvass classes ",class_names)
#print("my classes ",my_class_names)

#raw_input("press key to continue...")

# Load the training-set. This returns the images, the class-numbers as integers, and the class-numbers as One-Hot encoded arrays called labels.
# In[10]:

#images_train, cls_train, labels_train = cifar10.load_training_data()
my_labels_train_cls, my_images_train = li.load_label_image_list(
    "/home/peter/tensorflow_scripts/triset_train/tags.csv", 0, 30000)
#truncate label for testing with first number onls

my_labels_train_onehot = []
for x in my_labels_train_cls:
    my_labels_train_onehot.append(li.getonehot(x))
# Load the test-set.
#print("onehot : ",my_labels_train_onehot)
my_labels_train_onehot = np.array(my_labels_train_onehot)
print("onehot : ", my_labels_train_onehot.shape)
# In[11]:
print(my_labels_train_onehot)
#raw_input("...")

#images_test, cls_test, labels_test = cifar10.load_test_data()
Exemple #2
0
# Fully-connected layer.
fc_size = 128             # Number of neurons in fully-connected layer.


# ## Load Data

# The MNIST data-set is about 12 MB and will be downloaded automatically if it is not located in the given path.

# In[6]:


#from tensorflow.examples.tutorials.mnist import input_data
#data = input_data.read_data_sets('data/MNIST/', one_hot=True)

import loadimages as li
my_datatraincls, my_datatrainimages= li.load_label_image_list("/home/peter/tensorflow_notes/lesson5_trinumber_cnn/data/tags.csv", 0, 50000)
my_datatestcls, my_datatestimages= li.load_label_image_list("/home/peter/tensorflow_notes/lesson5_trinumber_cnn/data/tags.csv", 0, 10000)

    
my_onehottestcls = []
my_onehottraincls=[]

for x in my_datatraincls:
    my_onehottraincls.append(li.getonehot(int(x)))   
my_onehotraincls = np.array(my_onehottraincls)


for x in my_datatestcls:
    my_onehottestcls.append(li.getonehot(int(x)))
my_onehottestcls = np.array(my_onehottestcls)