def parse_args(): parser = argparse.ArgumentParser(description="Train deepim network") # general parser.add_argument("--cfg", help="experiment configure file name", required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument( "--frequent", help="frequency of logging", default=config.default.frequent, type=int, ) parser.add_argument("--gpus", help="specify the gpu to be use", required=True, type=str) parser.add_argument("--temp", help="turn on visualization", action="store_true") parser.add_argument("--vis", help="turn on visualization", action="store_true") args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train deepim network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) parser.add_argument('--gpus', help='specify the gpu to be use', required=True, type=str) parser.add_argument('--temp', help='turn on visualization', action='store_true') parser.add_argument('--vis', help='turn on visualization', action='store_true') args = parser.parse_args() return args
def parse_args(): """ :return: parsed arguments and (updated) config.cfg object """ parser = argparse.ArgumentParser( description='Train text recognition network') # general parser.add_argument( '--cfg', help='experiment configure file name', default='/home/citybuster/Projects/CRNN_STN_SEQ/experiments' '/synth90k/shadownet/normal_sts_shadownet_sgd_exponential-lr.yaml', type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument('--gpus', help='gpus', type=str) parser.add_argument('--workers', help='num of dataloader workers', type=int) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train deeplab network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) parser.add_argument('--backward-do-mirror', dest='backward_do_mirror', help='True means less gpu memory usage.', default=False, action='store_true') args, rest = parser.parse_known_args() # update config update_config(args.cfg) if args.backward_do_mirror: os.environ['MXNET_BACKWARD_DO_MIRROR'] = '1' # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a Deeplab Network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) parser.add_argument('--backward-do-mirror', dest='backward_do_mirror', help='True means less gpu memory usage.', default=False, action='store_true') args, rest = parser.parse_known_args() if args.backward_do_mirror: os.environ['MXNET_BACKWARD_DO_MIRROR'] = '1' update_config(args.cfg) # testing parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description="Test a DeepIM Network") # general parser.add_argument( "--cfg", help="experiment configure file name", required=True, type=str ) args, rest = parser.parse_known_args() update_config(args.cfg) # testing parser.add_argument("--vis", help="turn on visualization", action="store_true") parser.add_argument( "--vis_video", help="turn on video visualization", action="store_true" ) parser.add_argument( "--vis_video_zoom", help="turn on zoom video visualization", action="store_true" ) parser.add_argument( "--ignore_cache", help="ignore cached pose prediction results", action="store_true", ) parser.add_argument( "--gpus", help="specify the gpu to be use", required=True, type=str ) parser.add_argument( "--skip_flow", help="whether skip flow during test", action="store_true" ) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='train detnet network') parser.add_argument('--cfg',help='configure file name',type = str, default = './cfgs/detnet.yaml') args, rest = parser.parse_known_args() update_config(args.cfg) return args
def parse_args(): # print('test----parse_args----in----') parser = argparse.ArgumentParser(description='Test a R-FCN network') # general # 通常测试一个网络都是使用cfg文件yaml parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn # rcnn相应参数,包括vis可视化,ignore_cache忽视缓存,thresh有效检测的阈值,shuffle可视化中随机数据 parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() # print('test----parse_args----out----') return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a DeepIM Network') # general parser.add_argument( '--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # testing parser.add_argument( '--vis', help='turn on visualization', action='store_true') parser.add_argument( '--vis_video', help='turn on video visualization', action='store_true') parser.add_argument( '--vis_video_zoom', help='turn on zoom video visualization', action='store_true') parser.add_argument( '--ignore_cache', help='ignore cached pose prediction results', action='store_true') parser.add_argument( '--gpus', help='specify the gpu to be use', required=True, type=str) parser.add_argument( '--skip_flow', help='whether skip flow during test', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a Faster R-CNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') parser.add_argument('--test_epoch', help='the epoch model to be test', default=config.TEST.test_epoch, type=int) # nms parser.add_argument('--nms', help='params for nms or softnms', default=config.TEST.NMS, type=float) parser.add_argument('--softnms', help='whether to enable softnms', default=config.TEST.SOFTNMS, action='store_true') parser.add_argument('--naive_nms', help='whether to enable naive nms', default=False, action='store_true') parser.add_argument('--first_n', help='first_n for learn nms or nms', default=config.TEST.FIRST_N, type=int) parser.add_argument('--merge', help='merge method for learn nms', default=config.TEST.MERGE_METHOD, type=int) parser.add_argument('--debug', help='whether to enable debug mode', default=False, action='store_true') # dataset parser.add_argument('--test_set', help='which set to be tested', default=config.dataset.test_image_set, type=str) args, rest = parser.parse_known_args() # update config config.TEST.test_epoch = args.test_epoch config.TEST.NMS = args.nms config.TEST.SOFTNMS = args.softnms and (not args.naive_nms) config.TEST.FIRST_N = args.first_n config.TEST.MERGE_METHOD = args.merge config.dataset.test_image_set = args.test_set return args
def parse_args(): """ :return: parsed arguments and (updated) config.cfg object """ parser = argparse.ArgumentParser( description='Train text recognition network') # general parser.add_argument( '--cfg', help='experiment configure file name', default='/home/citybuster/Projects/CRNN_STN_SEQ/experiments/' 'synth90k/shadownet/stn_ctc_shadownet_sgd_exponential-lr.yaml', type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) parser.add_argument( '--data', help='The raw dataset dir', default='/home/citybuster/Data/mnt/ramdisk/max/90kDICT32px', type=str) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a R-FCN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Deploy a Faster R-CNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train PIX2PIX') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='demo of detnet network') # general parser.add_argument('--cfg', help='experiment configure file name', default='./cfgs/detnet.yaml', type=str) args, rest = parser.parse_known_args() parser.add_argument('--thresh', help='valid detection threshold', default=0.5, type=float) parser.add_argument('--image', help='image path', default='./images', type=str) args = parser.parse_args() update_config(args.cfg) return args
def main(): from utils.debug import set_working_dir # set the working directory as appropriate set_working_dir() args = parse_args() print('Called with argument:', args) # update config update_config(args.cfg) check_config(config) train()
def parse_args(): parser = argparse.ArgumentParser(description='Train FCIS Network') # general # configuration file is required parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(cur_path + '/../experiments/fcis/cfgs/' +args.cfg) args = parser.parse_args() return args
def init_detect_model(): # get symbol pprint.pprint(config) update_config(RFCN_DCN_CONFIG["config_yaml_file"]) config.symbol = 'resnet_v1_101_rfcn_dcn' sym_instance = eval(config.symbol + '.' + config.symbol)() sym = sym_instance.get_symbol(config, is_train=False) arg_params, aux_params = load_param(os.path.join( RFCN_DCN_CONFIG['modelParam']['modelBasePath'], 'rfcn_voc'), RFCN_DCN_CONFIG['modelParam']['epoch'], process=True) return [sym, arg_params, aux_params]
def parse_args(): parser = argparse.ArgumentParser(description='Show Flow-Guided Feature Aggregation demo') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train Faster-RCNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train R-FCN network') # general parser.add_argument('--cfg', help='experiment configure file name', default="../experiments/fgfa_rfcn/cfgs/resnet_v1_101_flownet_imagenet_vid_rfcn_end2end_ohem.yaml",type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train Faster-RCNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() # update config update_config(args.cfg) # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) args, rest = parser.parse_known_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a Faster R-CNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--use_box_voting', help='use box voting in test', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a Deeplab Network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # testing parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a R-FCN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-4, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a R-FCN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) parser.add_argument('--usePhilly', help='experiment is on the philly', action='store_true') args, rest = parser.parse_known_args() update_config(args.cfg) config.USE_PHILLY = args.usePhilly # modfication for philly if config.USE_PHILLY: parser.add_argument('--dataDir', help='input directory for Philly jobs', required=True, type=str) parser.add_argument('--modelDir', help='output directory for Philly jobs', required=True, type=str) args, rest = parser.parse_known_args() update_philly_config(args.modelDir, args.dataDir) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--show_gt', help='turn on visualization on gt', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-4, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') args = parser.parse_args() return args
def main(): args = parse_args() print 'Called with argument:', args cfg_path = args.cfg update_config(cfg_path) # create logger logger, output_path = create_logger(config.output_path, cfg_path, config.dataset.image_set) # print config pprint.pprint(config) logger.info('training config: {}\n'.format(pprint.pformat(config))) # train_net(cfg_path, ctx, config.network.pretrained, config.network.pretrained_epoch, # config.TRAIN.model_prefix, config.TRAIN.begin_epoch, config.TRAIN.end_epoch, # config.TRAIN.lr, config.TRAIN.lr_step) train_net(config, output_path, logger)
def main(): update_config(os.path.join(cur_path, 'demo/models', args.configYamlFile)) if args.visualize: if not args.visualizeOutPutPath: args.visualizeOutPutPath = os.path.join(cur_path, 'visualizeOutPutPath') if not os.path.exists(args.visualizeOutPutPath): os.makedirs(args.visualizeOutPutPath) if not os.path.exists(os.path.split(args.outputFilePath)[0]): os.makedirs(os.path.split(args.outputFilePath)[0]) fileOp = open(args.outputFilePath + "-" + str(args.epoch) + "-threshold-" + str(args.threshold), 'a+') # 追加的方式,如果不存在就创建 need_process_images_path_list = [] if args.localImageListFile: basePath = '' if args.localImageBasePath: basePath = args.localImageBasePath with open(args.localImageListFile, 'r') as f: for line in f.readlines(): line = line.strip() if len(line) == 0: continue if line.endswith('.jpg'): pass else: line = line + '.jpg' image_path = os.path.join(basePath, line) need_process_images_path_list.append(image_path) process_image_fun(isUrlFlag=False, imagesPath=need_process_images_path_list, fileOp=fileOp, vis=args.visualize) elif args.urlImageListFile: with open(args.urlImageListFile, 'r') as f: for line in f.readlines(): line = line.strip() if len(line) == 0: continue need_process_images_path_list.append(line) process_image_fun(isUrlFlag=True, imagesPath=need_process_images_path_list, fileOp=fileOp, vis=args.visualize) pass
def parse_args(): parser = argparse.ArgumentParser(description='Test a Faster R-CNN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') parser.add_argument('--sample-stride', help='sample stride', default=-1, type=int) parser.add_argument('--key-frame-interval', help='key frame interval', default=-1, type=int) parser.add_argument('--video-shuffle', help='video shuffle', action='store_true') parser.add_argument('--test-pretrained', help='test pretrained model', type=str) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Test a R-FCN network') # general # parser.add_argument('--cfg', help='experiment configure file name', required=False, type=str) parser.add_argument('--cfg', help='experiment configure file name', default='../experiments/fgfa_rfcn/cfgs/resnet_v1_101_flownet_imagenet_vid_rfcn_end2end_ohem.yaml', required=False, type=str) args, rest = parser.parse_known_args() update_config(args.cfg) # rcnn parser.add_argument('--orig_pred', help='True to get and evaluate original predictions. False to get predictions suited for REPP', action='store_true') parser.add_argument('--vis', help='turn on visualization', action='store_true') parser.add_argument('--ignore_cache', help='ignore cached results boxes', action='store_true') parser.add_argument('--thresh', help='valid detection threshold', default=1e-3, type=float) parser.add_argument('--shuffle', help='shuffle data on visualization', action='store_true') parser.add_argument('--dataset_path', help='path of the Imagenet VID dataset', type=str) args = parser.parse_args() return args
def parse_args(): parser = argparse.ArgumentParser(description='Train R-FCN network') # general parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) parser.add_argument('--usePhilly', help='experiment is on the philly', action='store_true') args, rest = parser.parse_known_args() # update config update_config(args.cfg) config.USE_PHILLY = args.usePhilly # modfication for philly if config.USE_PHILLY: parser.add_argument('--dataDir', help='input directory for Philly jobs', required=True, type=str) parser.add_argument('--modelDir', help='output directory for Philly jobs', required=True, type=str) args, rest = parser.parse_known_args() update_philly_config(args.modelDir, args.dataDir) # training parser.add_argument('--frequent', help='frequency of logging', default=config.default.frequent, type=int) args = parser.parse_args() return args
def main(): update_config(RFCN_DCN_CONFIG["config_yaml_file"]) time_str = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) visualizeOutPutPath = None if int(args.visualizeFlag) == 1: visualizeOutPutPath = os.path.join(os.path.dirname(args.imageListFile), "visDraw-" + time_str) if not os.path.exists(visualizeOutPutPath): os.makedirs(visualizeOutPutPath) outputFilePath = args.imageListFile + "-result-" + str( args.outputFileFlag) + '-' + time_str fileOp = open(outputFilePath, 'a+') # 追加的方式,如果不存在就创建 need_process_images_path_list = [] with open(args.imageListFile, 'r') as f: for line in f.readlines(): line = line.strip() if len(line) == 0: continue need_process_images_path_list.append(line) process_image_fun(urlFlag=args.urlFlag, imagesPath=need_process_images_path_list, fileOp=fileOp, vis=visualizeOutPutPath)
import os import sys import logging import pprint import cv2 from config.config import config, update_config from utils.image import resize, transform from PIL import Image import numpy as np # get config os.environ['PYTHONUNBUFFERED'] = '1' os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_ENABLE_GPU_P2P'] = '0' cur_path = os.path.abspath(os.path.dirname(__file__)) update_config(cur_path + '/../experiments/deeplab/cfgs/deeplab_cityscapes_demo.yaml') sys.path.insert(0, os.path.join(cur_path, '../external/mxnet', config.MXNET_VERSION)) import mxnet as mx from core.tester import pred_eval, Predictor from symbols import * from utils.load_model import load_param from utils.tictoc import tic, toc def parse_args(): parser = argparse.ArgumentParser(description='Show Deformable ConvNets demo') # general parser.add_argument('--deeplab_only', help='whether use Deeplab only (w/o Deformable ConvNets)', default=False, action='store_true') args = parser.parse_args() return args
import argparse import os import sys import logging import pprint import cv2 from config.config import config, update_config from utils.image import resize, transform import numpy as np # get config os.environ['PYTHONUNBUFFERED'] = '1' os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_ENABLE_GPU_P2P'] = '0' cur_path = os.path.abspath(os.path.dirname(__file__)) update_config(cur_path + '/../experiments/rfcn/cfgs/rfcn_coco_demo.yaml') sys.path.insert(0, os.path.join(cur_path, '../external/mxnet', config.MXNET_VERSION)) import mxnet as mx from core.tester import im_detect, Predictor from symbols import * from utils.load_model import load_param from utils.show_boxes import show_boxes from utils.tictoc import tic, toc from nms.nms import py_nms_wrapper, cpu_nms_wrapper, gpu_nms_wrapper def parse_args(): parser = argparse.ArgumentParser(description='Show Deformable ConvNets demo') # general parser.add_argument('--rfcn_only', help='whether use R-FCN only (w/o Deformable ConvNets)', default=False, action='store_true')
import argparse import os import glob import sys import logging import pprint import cv2 from config.config import config, update_config from utils.image import resize, transform import numpy as np # get config os.environ['PYTHONUNBUFFERED'] = '1' os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_ENABLE_GPU_P2P'] = '0' cur_path = os.path.abspath(os.path.dirname(__file__)) update_config(cur_path + '/../experiments/dff_rfcn/cfgs/dff_rfcn_vid_demo.yaml') sys.path.insert(0, os.path.join(cur_path, '../external/mxnet', config.MXNET_VERSION)) import mxnet as mx from core.tester import im_detect, Predictor from symbols import * from utils.load_model import load_param from utils.show_boxes import show_boxes, draw_boxes from utils.tictoc import tic, toc from nms.nms import py_nms_wrapper, cpu_nms_wrapper, gpu_nms_wrapper def parse_args(): parser = argparse.ArgumentParser(description='Show Deep Feature Flow demo') args = parser.parse_args() return args
import _init_paths import os import sys import pprint import cv2 from config.config import config, update_config from utils.image import resize, transform import numpy as np # get config os.environ['PYTHONUNBUFFERED'] = '1' os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_ENABLE_GPU_P2P'] = '0' cur_path = os.path.abspath(os.path.dirname(__file__)) update_config(cur_path + '/../experiments/rfcn/cfgs/deform_psroi_demo.yaml') sys.path.insert(0, os.path.join(cur_path, '../external/mxnet', config.MXNET_VERSION)) import mxnet as mx from core.tester import Predictor from symbols import * from utils.load_model import load_param from utils.show_offset import show_dpsroi_offset def main(): # get symbol pprint.pprint(config) sym_instance = eval(config.symbol + '.' + config.symbol)() sym = sym_instance.get_symbol_rfcn(config, is_train=False) # load demo data image_names = ['000057.jpg', '000149.jpg', '000351.jpg', '002535.jpg']