示例#1
0
import os

import mxnet

from mxnet.contrib.onnx import export_model


import mxnet as mx

from configs import ROOT_DIR

print(mx.context.num_gpus())
from mxnet.runtime import feature_list
print(feature_list())

input_shape = '3,112,112'
input_shape = (1,) + tuple( [int(x) for x in input_shape.split(',')] )
print('input-shape:', input_shape)

import onnx

assert onnx.__version__=='1.2.1'

export_model(sym=os.path.join(ROOT_DIR, 'networks/insightface/model-r100-ii/model-symbol.json'),
             params=os.path.join(ROOT_DIR, 'networks/insightface/model-r100-ii/model-0000.params'),
             input_shape=[input_shape],
             onnx_file_path=os.path.join(ROOT_DIR, 'networks/onnx/model.onnx'),
             verbose=True)

示例#2
0
from test_initializer_lecun_uniform import test_initializer_lecun_uniform
from test_initializer_he_normal import test_initializer_he_normal
from test_initializer_he_uniform import test_initializer_he_uniform
from test_initializer_truncated_normal import test_initializer_truncated_normal
from test_initializer_orthogonal import test_initializer_orthogonal
from test_initializer_variance_scaling import test_initializer_variance_scaling

origstdout = sys.stdout

print("Running Tests...")
sys.stdout = open("test_logs.txt", 'w')

try:
    print("System Check")
    from mxnet.runtime import feature_list
    print("Runtime elements     - {}".format(feature_list()))
    print("")
except:
    print("Installation incomplete")
    sys.exit(0)

system_dict = {}
system_dict["total_tests"] = 0
system_dict["successful_tests"] = 0
system_dict["failed_tests_lists"] = []
system_dict["failed_tests_exceptions"] = []
system_dict["skipped_tests_lists"] = []

start = time.time()

print("Running 1/<num>")