Exemplo n.º 1
0
 labels_name = argv[2]
 coords_name = argv[3]
 AI_saved_dir = argv[5]
 data, tracer, coords = astro_mnist.read_data_sets(images_name,
                                                   labels_name,
                                                   coords_name,
                                                   train_weight=0,
                                                   validation_weight=0,
                                                   test_weight=1)
 print("Size of:")
 print("- Training-set:\t\t{}".format(len(data.train.labels)))
 print("- Test-set:\t\t{}".format(len(data.test.labels)))
 print("- Validation-set:\t{}".format(len(data.validation.labels)))
 data.test.cls = np.argmax(data.test.labels, axis=1)
 # save arrangement and coords
 failure = save_arrangement(images_name[:-4], directory, data, tracer)
 if not failure:
     print("tracer and data is saved.")
 failure = save_coords(images_name[:-4], directory, coords)
 if not failure:
     print("coords are saved.")
 #-----------------------------------
 # Data dimension
 # We know that MNIST images are 28 pixels in each dimension.
 img_size = len(data.test.images[0])
 print("image size = {0}".format(img_size))
 # Images are stored in one-dimensional arrays of this length.
 img_size_flat = img_size * 1
 # Tuple with height and width of images used to reshape arrays.
 img_shape = (img_size, 1)
 # Number of colour channels for the images: 1 channel for gray-scale.
Exemplo n.º 2
0
     equal_batch = False
 else:
     print ("Wrong batch_format option")
     exit()
 #------------------------------------
 # Load Data
 # We should play a mask on image
 print ("starting time: {0}".format(time_stamp))
 data, tracer, coords = astro_mnist.read_data_sets(images_name, labels_name, coords_name)
 print("Size of:")
 print("- Training-set:\t\t{}".format(len(data.train.labels)))
 print("- Test-set:\t\t{}".format(len(data.test.labels)))
 print("- Validation-set:\t{}".format(len(data.validation.labels)))
 #-----------------------------------
 # save arrangement and coords
 failure = save_arrangement(images_name[:-4], time_stamp, data, tracer)
 if not failure:
     print ("tracers and data are saved.")
 failure = save_coords(images_name[:-4], time_stamp, coords)
 if not failure:
     print ("coords are saved.")
 #-----------------------------------
 # Data dimension
 img_maj = imply_mask.count('0')
 width_of_data = None
 pick_band_array = None
 if consider_error == 'yes':
     width_of_data = 2
     repeat_imply_mask = imply_mask + imply_mask
     pick_band_array = np.where(np.array(list(repeat_imply_mask), dtype = int) == 0)
 elif consider_error == 'no':
 VERBOSE = 0
 # measure times
 start_time = time.time()
 time_stamp = argv[3]
 #-----------------------------------
 # Load Data
 images_name = argv[1]
 labels_name = argv[2]
 data, tracer = astro_mnist.read_data_sets(images_name, labels_name)
 print("Size of:")
 print("- Training-set:\t\t{}".format(len(data.train.labels)))
 print("- Test-set:\t\t{}".format(len(data.test.labels)))
 print("- Validation-set:\t{}".format(len(data.validation.labels)))
 data.test.cls = np.argmax(data.test.labels, axis=1)
 # save the distribution
 if save_arrangement(argv, time_stamp, data, tracer):
     print("tracer and data is saved.")
 #-----------------------------------
 # Data dimension
 # We know that from the length of a data.
 img_size = len(data.train.images[0])
 print("image size = {0}".format(img_size))
 # Images are stored in one-dimensional arrays of this length.
 img_size_flat = img_size * 1
 # Tuple with height and width of images used to reshape arrays.
 img_shape = (img_size, 1)
 # Number of colour channels for the images: 1 channel for gray-scale.
 num_channels = 1
 # Number of classes, one class for each of 10 digits.
 num_classes = 3
 # the number of iterations