- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在研究“用于对象检测和分割的Mask R-CNN
”。因此,我阅读了原始研究论文,其中介绍了用于对象检测的Mask R-CNN
,并且我还发现了Mask R-CNN
的一些实现,here和 here (由 Facebook AI 研究团队称为 detectorron)。但他们都使用了coco数据集进行测试。
但是我对使用自定义数据集训练上述实现感到相当困惑,该数据集具有大量图像,并且对于每个图像都有一个掩码图像子集用于标记相应图像中的对象。
因此,如果有人可以为此任务发布有用的资源或代码示例,我会很高兴。
注意:我的数据集具有以下结构,
It consists with a large number of images and for each image, there are separate image files highlighting the object as a white patch in a black image.
这是一个示例图像及其蒙版:
图像;
面具;
最佳答案
我已经训练了 https://github.com/matterport/Mask_RCNN 的实例分割模型以在我的数据集上运行。
我的假设是您已完成所有基本设置,并且模型已经使用默认数据集(在存储库中提供)运行,现在您希望它针对自定义数据集运行。
以下是步骤
via_region_data.json
进行查找。例如,对于训练图像,它将查看train\via_region_data.json
。如果您愿意,也可以更改它。.py
文件(对于气球,它将是气球.py),更改以下变量
ROOT_DIR
:克隆项目的绝对路径DEFAULT_LOGS_DIR
:此文件夹的大小将变得更大,因此请相应地更改此路径(如果您在低磁盘存储虚拟机中运行代码)。它还将存储 .h5
文件。它将在日志文件夹内创建子文件夹,并附加时间戳。.h5
文件大约为 200 - 300 MB。但猜猜这个日志目录与 Tensorboard 兼容。您可以在运行tensorboard时将带时间戳的子文件夹作为--logdir
参数传递。.py
文件还包含两个类 - 一个后缀为 Config
的类,另一个后缀为 Dataset
的类。NAME
:您的项目的名称。NUM_CLASSES
:它应该比您的标签类别多一个,因为背景也被视为一个标签DETECTION_MIN_CONFIDENCE
:默认为 0.9(如果您的训练图像质量不是很高或者没有太多训练数据,请降低该值)STEPS_PER_EPOCH
等您现在可以直接从终端运行它
python samples\your_folder_name\your_python_file_name.py train --dataset="location_of_custom_dataset" --weights=coco
有关上述行命令行参数的完整信息,您可以将其视为此 .py
文件顶部的注释。
这些是我能记得的事情,我想补充更多我记得的步骤。如果您在任何特定步骤中遇到困难,也许您可以告诉我,我会详细说明该特定步骤。
VGG 多边形架构
宽度和高度是可选的
[{
"filename": "000dfce9-f14c-4a25-89b6-226316f557f3.jpeg",
"regions": {
"0": {
"region_attributes": {
"object_name": "Cat"
},
"shape_attributes": {
"all_points_x": [75.30864197530865, 80.0925925925926, 80.0925925925926, 75.30864197530865],
"all_points_y": [11.672189112257607, 11.672189112257607, 17.72093488703078, 17.72093488703078],
"name": "polygon"
}
},
"1": {
"region_attributes": {
"object_name": "Cat"
},
"shape_attributes": {
"all_points_x": [80.40123456790124, 84.64506172839506, 84.64506172839506, 80.40123456790124],
"all_points_y": [8.114103362391036, 8.114103362391036, 12.205901974737595, 12.205901974737595],
"name": "polygon"
}
}
},
"width": 504,
"height": 495
}]
load_mask 函数示例
def load_mask(self, image_id):
"""Generate instance masks for an image.
Returns:
masks: A bool array of shape [height, width, instance count] with
one mask per instance.
class_ids: a 1D array of class IDs of the instance masks.
"""
# If not your dataset image, delegate to parent class.
image_info = self.image_info[image_id]
if image_info["source"] != "name_of_your_project": //change your project name
return super(self.__class__, self).load_mask(image_id)
# Convert polygons to a bitmap mask of shape
# [height, width, instance_count]
info = self.image_info[image_id]
mask = np.zeros([info["height"], info["width"], len(info["polygons"])], dtype=np.uint8)
class_id = np.zeros([mask.shape[-1]], dtype=np.int32)
for i, p in enumerate(info["polygons"]):
# Get indexes of pixels inside the polygon and set them to 1
rr, cc = skimage.draw.polygon(p['all_points_y'], p['all_points_x'])
# print(rr.shape, cc.shape, i, np.ones([mask.shape[-1]], dtype=np.int32).shape, info['classes'][i])
class_id[i] = self.class_dict[info['classes'][i]]
mask[rr, cc, i] = 1
# Return mask, and array of class IDs of each instance. Since we have
# one class ID only, we return an array of 1s
return mask.astype(np.bool), class_id
关于python - 用于对象检测和分割的 Mask R-CNN [训练自定义数据集],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49684468/
我的一位教授给了我们一些考试练习题,其中一个问题类似于下面(伪代码): a.setColor(blue); b.setColor(red); a = b; b.setColor(purple); b
我似乎经常使用这个测试 if( object && object !== "null" && object !== "undefined" ){ doSomething(); } 在对象上,我
C# Object/object 是值类型还是引用类型? 我检查过它们可以保留引用,但是这个引用不能用于更改对象。 using System; class MyClass { public s
我在通过 AJAX 发送 json 时遇到问题。 var data = [{"name": "Will", "surname": "Smith", "age": "40"},{"name": "Wil
当我尝试访问我的 View 中的对象 {{result}} 时(我从 Express js 服务器发送该对象),它只显示 [object][object]有谁知道如何获取 JSON 格式的值吗? 这是
我有不同类型的数据(可能是字符串、整数......)。这是一个简单的例子: public static void main(String[] args) { before("one"); }
嗨,我是 json 和 javascript 的新手。 我在这个网站找到了使用json数据作为表格的方法。 我很好奇为什么当我尝试使用 json 数据作为表时,我得到 [Object,Object]
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
我听别人说 null == object 比 object == null check 例如: void m1(Object obj ) { if(null == obj) // Is thi
Match 对象 提供了对正则表达式匹配的只读属性的访问。 说明 Match 对象只能通过 RegExp 对象的 Execute 方法来创建,该方法实际上返回了 Match 对象的集合。所有的
Class 对象 使用 Class 语句创建的对象。提供了对类的各种事件的访问。 说明 不允许显式地将一个变量声明为 Class 类型。在 VBScript 的上下文中,“类对象”一词指的是用
Folder 对象 提供对文件夹所有属性的访问。 说明 以下代码举例说明如何获得 Folder 对象并查看它的属性: Function ShowDateCreated(f
File 对象 提供对文件的所有属性的访问。 说明 以下代码举例说明如何获得一个 File 对象并查看它的属性: Function ShowDateCreated(fil
Drive 对象 提供对磁盘驱动器或网络共享的属性的访问。 说明 以下代码举例说明如何使用 Drive 对象访问驱动器的属性: Function ShowFreeSpac
FileSystemObject 对象 提供对计算机文件系统的访问。 说明 以下代码举例说明如何使用 FileSystemObject 对象返回一个 TextStream 对象,此对象可以被读
我是 javascript OOP 的新手,我认为这是一个相对基本的问题,但我无法通过搜索网络找到任何帮助。我是否遗漏了什么,或者我只是以错误的方式解决了这个问题? 这是我的示例代码: functio
我可以很容易地创造出很多不同的对象。例如像这样: var myObject = { myFunction: function () { return ""; } };
function Person(fname, lname) { this.fname = fname, this.lname = lname, this.getName = function()
任何人都可以向我解释为什么下面的代码给出 (object, Object) 吗? (console.log(dope) 给出了它应该的内容,但在 JSON.stringify 和 JSON.parse
我正在尝试完成散点图 exercise来自免费代码营。然而,我现在只自己学习了 d3 几个小时,在遵循 lynda.com 的教程后,我一直在尝试确定如何在工具提示中显示特定数据。 This code
我是一名优秀的程序员,十分优秀!