Exemple #1
0
    opt.use_int8_inference = True
    opt.use_vulkan_compute = use_vulkan_compute
    opt.use_fp16_packed = True
    opt.use_fp16_storage = True
    opt.use_fp16_arithmetic = True
    opt.use_int8_storage = True
    opt.use_int8_arithmetic = True
    opt.use_packing_layout = True

    ncnn.set_cpu_powersave(powersave)
    ncnn.set_omp_dynamic(0)
    ncnn.set_omp_num_threads(num_threads)

    print("loop_count = %d" % (loop_count))
    print("num_threads = %d" % (num_threads))
    print("powersave = %d" % (ncnn.get_cpu_powersave()))
    print("gpu_device = %d" % (gpu_device))

    #must use named param w, h, c due to python has no size_t(unsigned int) to call the correct overload ncnn.Mat
    benchmark("squeezenet", ncnn.Mat(w=227, h=227, c=3), opt)
    benchmark("squeezenet_int8", ncnn.Mat(w=227, h=227, c=3), opt)
    benchmark("mobilenet", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("mobilenet_int8", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("mobilenet_v2", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("mobilenet_v3", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("shufflenet", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("shufflenet_v2", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("mnasnet", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("proxylessnasnet", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("googlenet", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("googlenet_int8", ncnn.Mat(w=224, h=224, c=3), opt)
Exemple #2
0
    opt.use_fp16_packed = True
    opt.use_fp16_storage = True
    opt.use_fp16_arithmetic = True
    opt.use_int8_storage = True
    opt.use_int8_arithmetic = True
    opt.use_packing_layout = True
    opt.use_shader_pack8 = False
    opt.use_image_storage = False

    ncnn.set_cpu_powersave(powersave)
    ncnn.set_omp_dynamic(0)
    ncnn.set_omp_num_threads(num_threads)

    print("loop_count =", loop_count)
    print("num_threads =", num_threads)
    print("powersave =", ncnn.get_cpu_powersave())
    print("gpu_device =", gpu_device)
    print("cooling_down =", g_enable_cooling_down)

    benchmark("squeezenet", ncnn.Mat((227, 227, 3)), opt)
    benchmark("squeezenet_int8", ncnn.Mat((227, 227, 3)), opt)
    benchmark("mobilenet", ncnn.Mat((224, 224, 3)), opt)
    benchmark("mobilenet_int8", ncnn.Mat((224, 224, 3)), opt)
    benchmark("mobilenet_v2", ncnn.Mat((224, 224, 3)), opt)
    # benchmark("mobilenet_v2_int8", ncnn.Mat(w=224, h=224, c=3), opt)
    benchmark("mobilenet_v3", ncnn.Mat((224, 224, 3)), opt)
    benchmark("shufflenet", ncnn.Mat((224, 224, 3)), opt)
    benchmark("shufflenet_v2", ncnn.Mat((224, 224, 3)), opt)
    benchmark("mnasnet", ncnn.Mat((224, 224, 3)), opt)
    benchmark("proxylessnasnet", ncnn.Mat((224, 224, 3)), opt)
    benchmark("efficientnet_b0", ncnn.Mat((224, 224, 3)), opt)