models icon indicating copy to clipboard operation
models copied to clipboard

SSD模型源码fluid.layers.py_reader方法参数问题

Open liuzengzhen1 opened this issue 7 years ago • 2 comments

想学习下paddle下了SSD的开源模型代码,里有涉及这个异步读取数据方法,对应api文档没有太看懂,具体代码如下: py_reader = fluid.layers.py_reader( capacity=64, shapes=[[-1] + image_shape, [-1, 4], [-1, 1], [-1, 1]], lod_levels=[0, 1, 1, 1], dtypes=["float32", "float32", "int32", "int32"], use_double_buffer=True) 主要是shapes这个参数,和lod_levels 实际应用传的什么呢,没有理解这4个参数具体对应的是什么

liuzengzhen1 avatar Aug 19 '19 07:08 liuzengzhen1

关于API的使用问题可以参考一下官网文档:

https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/layers_cn/io_cn.html#py-reader

https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/user_guides/howto/basic_concept/lod_tensor.html

liupluswei avatar Aug 19 '19 07:08 liupluswei

@liuzengzhen1 在SSD的repo下Code中py_reader真正读入的数据包括image, gt_box, gt_label, difficult。在fluid.layers.py_reader里shapes里第一个参数表示batch_size大小,默认-1,第2-5个参数分别表示image, gt_box, gt_label, difficult的维度。
在shapes下无法确定是否是变长数据,所以使用lod_levels字段来获取数据是否是变长的,lod_levels=[0, 1, 1, 1]中0表示不是变长,1表示是变长数据,这四个值分别对应image, gt_box, gt_label, difficult数据类型是否是变长。 其他参数可参考上面给出的官网文档。如还有疑问可继续留言。

yghstill avatar Aug 20 '19 05:08 yghstill