2019年1月31日星期四

Cannot import name relu6


Just execute these commands:
git clone https://github.com/apple/coremltools.git
cd coremltools
cmake . -DPYTHON=$(which python) -DPYTHON_CONFIG=$(which python-config)
make
pip install -e .

2019年1月29日星期二

FPN网络训练报错PaddingFIFOQueue '_1_get_batch/batch/padding_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)


https://github.com/DetectionTeamUCAS/FPN_Tensorflow
按说明设置自己的训练集后,进入tool/运行train.py后报错:

PaddingFIFOQueue '_1_get_batch/batch/padding_fifo_queue' is closed and has insufficient elements (requested 1, current size 0)

查了一下,应该是xml文件中box坐标范围导致的。修改data/io/convert_data/io/convert_to_tfrecord.py中line68为

  gtbox_label = np.array(box_list, dtype=np.int32)  # [x1, y1. x2, y2, label]

  xmin, ymin, xmax, ymax, label = gtbox_label[:, 0], gtbox_label[:, 1], gtbox_label[:, 2],\
      gtbox_label[:, 3], gtbox_label[:, 4]

  xmin = np.where(xmin <= 0, 1, xmin)
  ymin = np.where(ymin <= 0, 1, ymin)
  xmax = np.where(xmax >= img_width, img_width-1, xmax)
  ymax = np.where(ymax >= img_height, img_height-1, ymax)

  # [ymin, xmin, ymax, xmax, label]
  gtbox_label = np.transpose(np.stack([ymin, xmin, ymax, xmax, label], axis=0))

即可。












2019年1月16日星期三

TypeError: ...has type str, but expected one of: bytes

在python3环境中将数据转为TFRecord时遇到的问题
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
TypeError: 'rock' has type str, but expected one of: bytes

解决方式:
转byte feature时用tf.compat.as_bytes(value)将字节或 Unicode 转换为 bytes,使用 UTF-8 编码文本
def _bytes_feature(value):
  value = tf.compat.as_bytes(value)#####
  return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))

2019年1月9日星期三

pip2与pip3共存

之前修改了导致pip2无法使用,导致一些开发工具无法使用。 可以先解除 python3的软连接, 然后再修改成 python2的. mac 自带的是 python2.7
1. 先获取2.7的路径:
which python2.7, 我的是/usr/bin/python2.7
2. 解除原有链接 unlink /usr/bin/python
3. 恢复默认链接: sudo ln -s python2 /usr/bin/python

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...