コード例 #1
0
        'Plot the graphs of prediction accuracy of the network vs. fixations',
        action="store_true")

    args = parser.parse_args()

    # Load data
    load_data = LoadData()
    slide_sequences, slide_selections = load_data.get_RNN_data_selection()
    max_sequence_lengths = load_data.get_max_sequence_lengths()
    NUM_SUBJECTS = slide_selections.shape[1]
    _, _, _, corr_imgs = load_data.get_other_var()

    if args.from_scratch:
        #Load models
        network = Network()
        network.load_models("SELECTION")
        models = network.get_models(
        )  #NUM_SLIDES x k model (each slide has k folds)

        stratified_kfold = StratifiedKFold(n_splits=k,
                                           shuffle=True,
                                           random_state=seed)

        # a database of all probability vs fixation for all slides and all images in each slide
        # e.g. all_prob_fix_arr[20][5] will show the whole progression of probability vs fixation for slide 21, image 6
        all_prob_fix_arr = []

        # a database of all prediction accuracy vs fixation for all slides
        # e.g. all_acc_arr[20] returns an array of max_sequence_lengths[20] elements
        all_acc_fix_arr = []
コード例 #2
0
    
    model_type_name = "CORRECT"
    print("model_type_name: ", model_type_name)
    load_data = LoadData()
    if model_type_name == "SELECTION":
        slide_sequences, slide_labels = load_data.get_RNN_data_selection()
    else:
        slide_sequences, slide_labels = load_data.get_RNN_data()
    max_sequence_lengths = load_data.get_max_sequence_lengths()

    args = parser.parse_args()
    
    
    
    network = Network()
    network.load_models(model_type_name)
    model = network.get_models()
    
    method = int(args.method)
    if method == 1:
        ablated_sequences = modify_all_sequences(slide_sequences, 0, 'shuffle', 'post')
    elif method == 2:
        ablated_sequences = modify_all_sequences(slide_sequences, 'half', 'discard', 'post')
    elif method == 3:
        ablated_sequences = modify_all_sequences(slide_sequences, 'half', 'discard', 'pre')
    elif method == 4:
        ablated_sequences = modify_all_sequences(slide_sequences, 'half', 'shuffle', 'pre')
    elif method == 5:
        ablated_sequences = modify_all_sequences(slide_sequences, 'half', 'shuffle', 'post')
    elif method == 6:
        ablated_sequences = modify_all_sequences(slide_sequences, 'half', 'shuffle', 'post')    #shuffle second half