Open wzzju opened 6 years ago
caffe.proto 中,在priorbox参数添加3个参数: repeated float fixed_size = 20; repeated float fixed_ratio = 21; repeated float density = 22;
@xyoungli 谢谢。
@xyoungli 你好,我加了这三个参数到caffe.proto里:
message PriorBoxParameter {
// Encode/decode type.
enum CodeType {
CORNER = 1;
CENTER_SIZE = 2;
CORNER_SIZE = 3;
}
// Minimum box size (in pixels). Required!
repeated float min_size = 1;
// Maximum box size (in pixels). Required!
repeated float max_size = 2;
// Various of aspect ratios. Duplicate ratios will be ignored.
// If none is provided, we use default ratio 1.
repeated float aspect_ratio = 3;
// If true, will flip each aspect ratio.
// For example, if there is aspect ratio "r",
// we will generate aspect ratio "1.0/r" as well.
optional bool flip = 4 [default = true];
// If true, will clip the prior so that it is within [0, 1]
optional bool clip = 5 [default = false];
// Variance for adjusting the prior bboxes.
repeated float variance = 6;
// By default, we calculate img_height, img_width, step_x, step_y based on
// bottom[0] (feat) and bottom[1] (img). Unless these values are explicitely
// provided.
// Explicitly provide the img_size.
optional uint32 img_size = 7;
// Either img_size or img_h/img_w should be specified; not both.
optional uint32 img_h = 8;
optional uint32 img_w = 9;
// Explicitly provide the step size.
optional float step = 10;
// Either step or step_h/step_w should be specified; not both.
optional float step_h = 11;
optional float step_w = 12;
// Offset to the top left corner of each cell.
optional float offset = 13 [default = 0.5];
// lj
repeated float fixed_size = 20;
repeated float fixed_ratio = 21;
repeated float density = 22;
}
但是我又遇到了另一个问题:
Traceback (most recent call last):
File "/Users/xxx/Anakin/tools/external_converter_v2/converter.py", line 20, in <module>
graph = Graph(config)
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/graph.py", line 23, in __init__
from caffe import CaffeParser
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/caffe/__init__.py", line 5, in <module>
from parser_caffe import *
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/caffe/parser_caffe.py", line 9, in <module>
from caffe_helper import *
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/caffe/caffe_helper.py", line 6, in <module>
from ..pbs import *
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/pbs/__init__.py", line 13, in <module>
m = __import__(module[:-3], locals(), globals())
File "/Users/xxx/Anakin/tools/external_converter_v2/parser/pbs/caffe_pb2.py", line 23, in <module>
fle_images\x18@ \x01(\x08:\x05\x66\x61lse\x12\x15\n\nconcat_dim\x18\x41 \x01(\r:\x01\x31\x12\x36\n\x11hdf5_output_param\x18\xe9\x07 \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"W\n\x0ePReLUParameter\x12&\n\x06\x66iller\x18\x01 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x1d\n\x0e\x63hannel_shared\x18\x02 \x01(\x08:\x05\x66\x61lse*\x1c\n\x05Phase\x12\t\n\x05TRAIN\x10\x00\x12\x08\n\x04TEST\x10\x01')
File "/Users/xxx/anaconda2/envs/vf/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 878, in __new__
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "caffe.proto":
caffe.proto: A file with this name is already in the pool.
请问应该怎么解决呢? Thanks in advance!
Anakin branch: developing (already up to date) protobuf version: 3.6.0
你的分支是 developing。这个问题是 protoc 尝试导入多个相同文件名的 proto 引起的冲突。你的描述看起来是 caffe.proto 冲突了。最新版本的 parser 会在运行之前清理 proto 缓存,请切换到 master 分支试试。@Knownx
@Shixiaowei02 切换到master分支并更新代码后问题解决,谢谢!
config.yaml的文件内容如下:
其中caffe.proto文件使用来源为:
https://github.com/weiliu89/caffe/blob/ssd/src/caffe/proto/caffe.proto
MobileNet-SSD模型来源为:https://github.com/chuanqi305/MobileNet-SSD
运行
python converter.py
命令,执行过程中出现如下错误:请求帮助,非常感谢!