parser.add_argument('--render', action='store_true') parser.add_argument('--mpc_horizon', type=int, default=15) parser.add_argument('--num_random_action_selection', type=int, default=4096) parser.add_argument('--nn_layers', type=int, default=1) parser.add_argument('--CEM_mode', action="store_true") args = parser.parse_args() data_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') exp_name = '{0}_{1}_{2}'.format( args.env, args.question, args.exp_name if args.exp_name else time.strftime("%d-%m-%Y_%H-%M-%S")) exp_dir = os.path.join(data_dir, exp_name) assert not os.path.exists(exp_dir),\ 'Experiment directory {0} already exists. Either delete the directory, or run the experiment with a different name'.format(exp_dir) os.makedirs(exp_dir, exist_ok=True) logger.setup(exp_name, os.path.join(exp_dir, 'log.txt'), 'debug') env = {'HalfCheetah': HalfCheetahEnv()}[args.env] mbrl = ModelBasedRL( env=env, render=args.render, mpc_horizon=args.mpc_horizon, num_random_action_selection=args.num_random_action_selection, nn_layers=args.nn_layers, CEM_mode=args.CEM_mode) run_func = { 'q1': mbrl.run_q1, 'q2': mbrl.run_q2, 'q3': mbrl.run_q3
# add common library from logger import logger, log logger.setup('./logs', name='efficientDet-d5-cutmix-sgd') from lib import * from config import config from dataset import WheatDataset, get_train_transforms, get_valid_transforms from utils import seed_everything, read_csv, kfold from trainer import Trainner, collate_fn from efficientdet_master.effdet import get_efficientdet_config, EfficientDet, DetBenchTrain from efficientdet_master.effdet.efficientdet import HeadNet def get_net(): # config = get_efficientdet_config('tf_efficientdet_d7') # net = EfficientDet(config, pretrained_backbone=False) # checkpoint = torch.load('./input/efficientdet/tf_efficientdet_d7-f05bf714.pth') #D7 net_config = get_efficientdet_config('tf_efficientdet_d5') net = EfficientDet(net_config, pretrained_backbone=config.use_pretrained) checkpoint = torch.load( './input/efficientdet/tf_efficientdet_d5-ef44aea8.pth') #D5 net.load_state_dict(checkpoint) net_config.num_classes = 1 net_config.image_size = 1024 net.class_net = HeadNet(net_config, num_outputs=net_config.num_classes, norm_kwargs=dict(eps=.001, momentum=.01)) return DetBenchTrain(net, net_config)