예제 #1
0
                                    flag = False
                                    break
                            else:
                                flag = False
                                break
    end = time.time()
    if (flag):
        print("acasxu property ", specnumber, "Verified")
    else:
        print("acasxu property ", specnumber, "Failed")

    print(end - start, "seconds")

elif zonotope_bool:
    perturbed_label, nn, nlb, nub = eran.analyze_zonotope(
        zonotope, domain, args.timeout_lp, args.timeout_milp,
        args.use_area_heuristic)
    print("nlb ", nlb[len(nlb) - 1])
    #print("nub ",nub)
    if (perturbed_label != -1):
        print("Verified")
    #elif(complete==True):
    #     verified_flag,adv_image = verify_network_with_milp_zonotope(nn, zonotope, label, nlb, nub)
    #     if(verified_flag==True):
    #         print("Verified")
    #     else:
    #         print("Failed")
    else:
        print("Failed")
else:
    for i, test in enumerate(tests):
예제 #2
0
파일: __main__.py 프로젝트: z971586668/eran
                                    flag = False
                                    break
                            if config.debug:
                                print('split', i, j, k, l, m)
        end = time.time()
        #print(complete_list)
        if (flag):
            print("acasxu property ", config.specnumber, "Verified")
        else:
            print("acasxu property ", config.specnumber, "Failed")

        print(end - start, "seconds")

elif zonotope_bool:
    perturbed_label, nn, nlb, nub = eran.analyze_zonotope(
        zonotope, domain, config.timeout_lp, config.timeout_milp,
        config.use_default_heuristic)
    print("nlb ", nlb[-1])
    print("nub ", nub[-1])
    if (perturbed_label != -1):
        print("Verified")
    elif (complete == True):
        constraints = get_constraints_for_dominant_label(perturbed_label, 10)
        verified_flag, adv_image = verify_network_with_milp(
            nn, zonotope, [], nlb, nub, constraints)
        if (verified_flag == True):
            print("Verified")
        else:
            print("Failed")
    else:
        print("Failed")
예제 #3
0
        specLB = np.copy(image)
        specUB = np.copy(image)

        if(is_trained_with_pytorch):
            normalize(specLB, means, stds)
            normalize(specUB, means, stds)

        if domain=='refinezono':
            init_domain = 'deepzono'
        elif domain=='refinepoly':
            init_domain = 'deeppoly'
        else:
            init_domain = domain

        if zonotope_bool:
            label,nn,nlb,nub = eran.analyze_zonotope(specLB, np.zeros_like(zonotope), init_domain, args.timeout_lp, args.timeout_milp, args.use_area_heuristic)
        else:
            label,nn,nlb,nub = eran.analyze_box(specLB, specUB, init_domain, args.timeout_lp, args.timeout_milp, args.use_area_heuristic)
        #for number in range(len(nub)):
        #    for element in range(len(nub[number])):
        #        if(nub[number][element]<=0):
        #            print('False')
        #        else:
        #            print('True')

        #print("concrete ", nlb[len(nlb)-1])
        #if(label == int(test[0])):
        if(label == int(test[0])):
            perturbed_label = None
            if zonotope_bool:
                perturbed_label, _, nlb, nub = eran.analyze_zonotope(specLB, zonotope, domain, args.timeout_lp, args.timeout_milp, args.use_area_heuristic)