Example #1
0
 print ('batch format: {0}'.format(batch_format))
 print ('iterations upper limit: {0}'.format(iterations_upperlimit))
 print ('validation function: {0}'.format(validation_func))
 iterations_upperlimit = int(iterations_upperlimit)
 if batch_format == 'equal':
     equal_batch = True
 elif batch_format == 'random':
     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')
#--------------------------------------------
# main code
if __name__ == "__main__":
    VERBOSE = 0
    # measure times
    start_time = time.time()
    directory = argv[4]
    #-----------------------------------
    # Load Data
    images_name = argv[1]
    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.")
    #-----------------------------------