def __init__(self, argvs=[]):
        # self.argv_parser(argvs)

        parser = OptionParser()
        parser.add_option("-c",
                          "--conf",
                          dest="configure",
                          help="configure filename")
        (options, args) = parser.parse_args()
        if options.configure:
            conf_file = str(options.configure)
            print('config loaded')
        else:
            print('please specify --conf configure filename')
            exit(0)
        self.common_params, self.dataset_params, self.net_params, self.solver_params = process_config(
            conf_file)
        print(self.common_params)
        print(self.dataset_params)
        print(self.net_params)
        print(self.solver_params)
        self.image_size = int(self.common_params['image_size'])
        self.batch_size = int(self.common_params['batch_size'])
        self.cell_size = int(self.net_params['cell_size'])
        self.boxes_per_cell = int(self.net_params['boxes_per_cell'])
        self.num_classes = int(self.common_params['num_classes'])
        self.object_scale = float(self.net_params['object_scale'])
        self.noobject_scale = float(self.net_params['noobject_scale'])
        self.class_scale = float(self.net_params['class_scale'])
        self.coord_scale = float(self.net_params['coord_scale'])
        self.max_objects = int(self.common_params['max_objects_per_image'])
        self.max_iterators = int(self.solver_params['max_iterators'])
        self.learning_rate = float(self.solver_params['learning_rate'])

        self.moment = float(self.solver_params['moment'])
        self.train_dir = self.solver_params['train_dir']
        self.pretrain_path = str(self.solver_params['pretrain_model_path'])
        self.build_networks()
        # self.fromfile ='./cat.jpg'
        if self.fromfile is not None: self.detect_from_file(self.fromfile)
import sys
from optparse import OptionParser

sys.path.append('./')
sys.path.append('./yolo/')
import yolo
from yolo.utils.process_config import process_config

parser = OptionParser()
parser.add_option("-c", "--conf", dest="configure", help="configure filename")
(options, args) = parser.parse_args()
if options.configure:
    conf_file = str(options.configure)
else:
    print('please sspecify --conf configure filename')
    exit(0)

common_params, dataset_params, net_params, solver_params = process_config(
    conf_file)
dataset = eval(dataset_params['name'])(common_params, dataset_params)
net = eval(net_params['name'])(common_params, net_params)
solver = eval(solver_params['name'])(dataset, net, common_params,
                                     solver_params)
solver.solve()
Exemplo n.º 3
0
from optparse import OptionParser

sys.path.append('./')

import yolo
import os
from yolo.utils.process_config import process_config

parser = OptionParser()
parser.add_option("-c", "--conf", dest="configure",  
                  help="configure filename")
parser.add_option("-g", "--gpu", dest="gpu",  
                  help="gpu_to_use")
(options, args) = parser.parse_args() 
if options.configure:
  conf_file = str(options.configure)
else:
  print('please sspecify --conf configure filename')
  exit(0)

if options.gpu:
    os.environ['CUDA_VISIBLE_DEVICES'] = options.gpu
else:
  print('please specify --gpu 0')
  exit(0)

common_params, dataset_params, net_params, solver_params = process_config(conf_file)
dataset = eval(dataset_params['name'])(common_params, dataset_params)
net = eval(net_params['name'])(common_params, net_params)
solver = eval(solver_params['name'])(dataset, net, common_params, solver_params)
solver.solve()