def run(self):
"""This method runs in the new process."""
global logger
setup_exceptions()
logger = log_utils.setup_logger('tile_worker')
if self.caffe_path is not None:
sys.path.append(self.caffe_path + '/python')
if self.device >= 0:
os.environ['CUDA_VISIBLE_DEVICES'] = str(self.device)
import caffe
if self.device >= 0:
caffe.set_mode_gpu()
else:
caffe.set_mode_cpu()
caffe.set_random_seed(0)
np.random.seed(0)
self.model = CaffeModel(*self.model_info)
self.model.img = np.zeros((3, 1, 1), dtype=np.float32)
while True:
try:
self.process_one_request()
except KeyboardInterrupt:
break
评论列表
文章目录