Exemplo n.º 1
0
model_flag = 'faster_rcnn_resnet50_coco_2018_01_28'

placeholder_save_path = os.path.join(
    root_path, 'results/' + model_flag + '/placeholders.txt')

path_input_ssd_pb = os.path.join(
    root_path, 'model_whole/' + model_flag + '/frozen_inference_graph.pb')
outpath = os.path.join(root_path, 'model_parts/' + model_flag + '/')
name_pb1 = 'tmp_1.pb'
name_pb2 = 'tmp_2.pb'

scopes2 = ['SecondStage']
ps1 = split_graph(path_input_ssd_pb,
                  outpath,
                  name_pb1,
                  name_pb2,
                  scopes_pb2=scopes2,
                  optypes_pb2=None,
                  opnames_pb2=None,
                  savepbtxt=False)

###########################
path_input_ssd_pb = os.path.join(root_path,
                                 'model_parts/' + model_flag + '/tmp_1.pb')
outpath = os.path.join(root_path, 'model_parts/' + model_flag + '/')
name_tmp = 'tmp.pb'
name_pb1 = 'part_1.pb'
name_pb2 = 'part_2.pb'
name_pb3 = 'part_3.pb'

scopes2 = [
    'FirstStageFeatureExtractor', 'BatchMultiClassNonMaxSuppression', 'map',
Exemplo n.º 2
0
model_flag = 'cycle-gan'

path_input_ssd_pb = os.path.join(
    root_path, 'model_whole/' + model_flag + '/apple2orange.pb')
outpath = os.path.join(root_path, 'model_parts/' + model_flag + '/')

name_pb1 = 'part_1.pb'
name_pb2 = 'part_2.pb'

placeholder_save_path = os.path.join(
    root_path, 'results/' + model_flag + '/placeholders.txt')

scopes2 = ['map_4']

ps1 = split_graph(path_input_ssd_pb,
                  outpath,
                  name_pb1,
                  name_pb2,
                  scopes_pb2=scopes2,
                  optypes_pb2=None,
                  opnames_pb2=None,
                  savepbtxt=False)

with open(placeholder_save_path, 'w+') as psp:
    psp.write('p1:\n')
    print('p1:')
    for p in ps1:
        psp.write(p + '\n')
        print(p)