- 打开github源码链接:github源码项目

- 打开上方地址下载数据集和权重:


3. 解压源码文件夹:把着标记的三个文件放到源码文件夹里

改model.py中这些函数:
在代码开头加上:
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '/gpu:0'
函数替代:
tf.log() -> tf.math.log()
tf.sets.set_intersection() -> tf.sets.intersection()
tf.sparse_tensor_to_dense() -> tf.sparse.to_dense()
tf.to_float() -> tf.cast([value], tf.float32)
tf.to_int-> tf.cast(my_tensor, tf.int32)
tf.rint()-> tf.math.rint()
#refined_rois = tf.to_int32(tf.rint(refined_rois))-------错误
refined_rois = tf.cast(tf.math.rint(refined_rois), tf.int32)-----正确
#tf.to_float([tf.gather(pre_nms_rois, ixs)]),
tf.cast(tf.gather(pre_nms_rois, ixs), tf.float32),
照着下面图片改:
balloon.py的parameters配置:
splash --weights=../../mask_rcnn_balloon.h5 --image=../../balloon/val/3800636873_ace2c2795f_b.jpg
运行ballon.py
结果:
原图:
版权声明:本文为weixin_43694742原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。