其他分享
首页 > 其他分享> > 深度踩坑 tensorflow RCNN

深度踩坑 tensorflow RCNN

作者:互联网

结构总结

1.分布式.py调用方法

一个文件夹下有多级目录。主程序得调用不同文件夹里的.py, 

#从文件夹mrcnn里调用utils.py
from mrcnn import utils

#从文件夹mrcnn里调用model.py,简写成modellib
import mrcnn.model as modellib

#从文件夹mrcnn里调用config.py的子函数Config
from mrcnn.config import Config

#从文件夹mrcnn里调用model.py的子函数Config
from mrcnn import model as modellib, utils


3.定义根目录

报错  No module named 'utils'

解决方案:

# 定位根目录Root //directory of the project
ROOT_DIR = os.path.abspath("E:/DP_project/detection_car/Mask_RCNN-master/samples/balloon")

# 调用Mask RCNN //Import Mask RCNN
sys.path.append(ROOT_DIR)  # 把目录加载到环境变量中 //To find local version of the library

3.定义配置文件

config = balloon.BalloonConfig() #套路
BALLOON_DIR = os.path.join(ROOT_DIR, "datasets/balloon")

4.数据集路径

dataset = balloon.BalloonDataset()#套路
dataset.load_balloon(BALLOON_DIR, "train")#加载这个

# Must call before using the dataset
dataset.prepare()

print("Image Count: {}".format(len(dataset.image_ids)))
print("Class Count: {}".format(dataset.num_classes))
for i, info in enumerate(dataset.class_info):
    print("{:3}. {:50}".format(i, info['name']))

 

标签:mrcnn,RCNN,balloon,py,dataset,文件夹,深度,tensorflow,DIR
来源: https://blog.csdn.net/iajin/article/details/91047115