@@ -0,0 +1,1687 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A__author__ = 'ar'%0A%0Aimport os%0Aimport time%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport logging%0Aimport argparse%0Aimport app.core.segmct.fcnn_lesion3dv3 as fcn3dv3%0A%0A# class Args:%0A#     mode_run    = 'infer'%0A#     mode_cls    = 'mclass'%0A#     crop3d      = '96x96x64'%0A#     is_zerobg   = False%0A#     infer_shape = '512x512x256'%0A#     infer_crop  = '128x128x64'%0A#     infer_pad   = 32%0A#     idx_trn     = None%0A#     idx_val     = None%0A#     model       = None%0A#     img         = None%0A#     lung        = None%0A#     infer_out   = None%0A%0A%0Aif __name__ == '__main__':%0A    logging.basicConfig(level=logging.INFO)%0A    path_img = '../../experimental_data/test_cases_for_segm/TB1_004_11053_1_16777217.nii.gz'%0A    path_msk_lungs = '../../experimental_data/test_cases_for_segm/TB1_004_11053_1_16777217.nii.gz-lungs.nii.gz'%0A    path_msk_out = '%7B%7D-lesionv3.nii.gz'%0A    path_model = '../../experimental_data/models/fcn3d_ct_lesion_segm_v3_tf/idx-all.txt-trn-s1.txt_fcn3d_valloss_96x96x64_bgFalse.h5'%0A    print('-')%0A    args = fcn3dv3.get_args_obj()%0A    args.model  = path_model%0A    args.img    = path_img%0A    args.lung   = path_msk_lungs%0A    args.infer_out = path_msk_out%0A    #%0A    cfg = fcn3dv3.Config(args)%0A    t1 = time.time()%0A    model = fcn3dv3.build_model(cfg, inp_shape=list(cfg.infer_crop_pad) + %5B1%5D)%0A    model.summary()%0A    logging.info('%5Ctloading model weights from %5B%7B%7D%5D'.format(cfg.path_model))%0A    model.load_weights(cfg.path_model, by_name=True)%0A    ret_cls, ret_pmap = fcn3dv3.run_inference(cfg, model, path_out_nii=cfg.infer_out)%0A    dt = time.time() - t1%0A    logging.info('%5Ct%5Ctdone... dt ~ %7B:0.3f%7D (s) * %5B%7B%7D%5D'.format(dt, cfg.path_img))

test inference code