-
大小: 18KB文件类型: .py金币: 1下载: 0 次发布日期: 2021-05-13
- 语言: Python
- 标签: ssd_pascal
资源简介
ssd_pascal
代码片段和文件信息
from __future__ import print_function
import caffe
from caffe.model_libs import *
from google.protobuf import text_format
import math
import os
import shutil
import stat
import subprocess
import sys
# Add extra layers on top of a “base“ network (e.g. VGGNet or Inception).
def AddExtralayers(net use_batchnorm=True):
use_relu = True
# Add additional convolutional layers.
from_layer = net.keys()[-1]
# TODO(weiliu89): Construct the name using the last layer to avoid duplication.
out_layer = “conv6_1“
ConvBNlayer(net from_layer out_layer use_batchnorm use_relu 256 1 0 1)
from_layer = out_layer
out_layer = “conv6_2“
ConvBNlayer(net from_layer out_layer use_batchnorm use_relu 512 3 1 2)
for i in xrange(7 9):
from_layer = out_layer
out_layer = “conv{}_1“.format(i)
ConvBNlayer(net from_layer out_layer use_batchnorm use_relu 128 1 0 1)
from_layer = out_layer
out_layer = “conv{}_2“.format(i)
ConvBNlayer(net from_layer out_layer use_batchnorm use_relu 256 3 1 2)
# Add global pooling layer.
name = net.keys()[-1]
net.pool6 = L.Pooling(net[name] pool=P.Pooling.AVE global_pooling=True)
return net
### Modify the following parameters accordingly ###
# The directory which contains the caffe code.
# We assume you are running the script at the CAFFE_ROOT.
caffe_root = os.getcwd()
# Set true if you want to start training right after generating all files.
run_soon = True
# Set true if you want to load from most recently saved snapshot.
# Otherwise we will load from the pretrain_model defined below.
resume_training = True
# If true Remove old model files.
remove_old_models = False
# The database file for training data. Created by data/VOC2007/create_data.sh
train_data = “examples/VOC2007/VOC2007_trainval_lmdb“
# The database file for testing data. Created by data/VOC2007/create_data.sh
test_data = “examples/VOC2007/VOC2007_test_lmdb“
# Specify the batch sampler.
resize_width = 300
resize_height = 300
resize = “{}x{}“.format(resize_width resize_height)
batch_sampler = [
{
‘sampler‘: {
}
‘max_trials‘: 1
‘max_sample‘: 1
}
{
‘sampler‘: {
‘min_scale‘: 0.3
‘max_scale‘: 1.0
‘min_aspect_ratio‘: 0.5
‘max_aspect_ratio‘: 2.0
}
‘sample_constraint‘: {
‘min_jaccard_overlap‘: 0.1
}
‘max_trials‘: 50
‘max_sample‘: 1
}
{
‘sampler‘: {
‘min_scale‘: 0.3
‘max_scale‘: 1.0
‘min_aspect_ratio‘: 0.5
‘max_aspect_ratio‘: 2.0
}
‘sample_constraint‘: {
- 上一篇:基于多变量线性回归的房屋销售价格预测.zip
- 下一篇:python api chm
评论
共有 条评论