mask rcnn实例分割_使用Mask-RCNN的实例分割
mask rcnn實(shí)例分割
In this article, I will be creating my own trained model for detecting potholes. For detection, I will be using the instance segmentation technique using the Mask-RCNN with the help of Supervisely.
在本文中,我將創(chuàng)建自己的訓(xùn)練有素的模型來檢測(cè)坑洼。 為了進(jìn)行檢測(cè),我將在Supervisely的幫助下使用Mask-RCNN使用實(shí)例分割技術(shù)。
Before creating our model lets get to know what tools and techniques we are using.
在創(chuàng)建模型之前,讓我們了解我們正在使用哪些工具和技術(shù)。
什么是實(shí)例細(xì)分? (What is Instance Segmentation?)
Instance segmentation is a technique used for detecting by masking or covering a detected object pixel to pixel. Instance segmentation is very useful in Automatic car as we get pixel to pixel result which increases the accuracy of less accidents
實(shí)例分割是一種用于通過掩蔽或覆蓋檢測(cè)到的對(duì)象像素到像素來進(jìn)行檢測(cè)的技術(shù)。 實(shí)例分割在自動(dòng)駕駛汽車中非常有用,因?yàn)槲覀儷@得了像素到像素的結(jié)果,這增加了較少事故的準(zhǔn)確性
面罩-RCNN (Mask-RCNN)
Mask-RCNN is a deep neural network aimed to solve instance segmentation problem in machine learning or computer vision. There are two stages of Mask RCNN. First, it generates proposals about the regions where there might be an object based on the input image. Second, it predicts the class of the object, refines the bounding box and generates a mask in pixel level of the object based on the first stage proposal.
Mask-RCNN是一個(gè)深度神經(jīng)網(wǎng)絡(luò),旨在解決機(jī)器學(xué)習(xí)或計(jì)算機(jī)視覺中的實(shí)例分割問題。 Mask RCNN有兩個(gè)階段。 首先,它基于輸入圖像生成有關(guān)可能存在對(duì)象的區(qū)域的建議。 其次,它根據(jù)第一階段的建議,預(yù)測(cè)對(duì)象的類別,優(yōu)化邊界框并在對(duì)象的像素級(jí)別生成掩碼。
Mask-RCNN is actually a trained model but in this article I will be showing you how to fine tune or train the Mask-RCNN model for your own custom objects.
Mask-RCNN實(shí)際上是經(jīng)過訓(xùn)練的模型,但是在本文中,我將向您展示如何為自己的自定義對(duì)象微調(diào)或訓(xùn)練Mask-RCNN模型。
Mask-RCNN structureMask-RCNN結(jié)構(gòu)什么是監(jiān)督以及如何使用? (What is Supervisely and how to use it ?)
Supervisely is a web platform used for solving computer vision problem. With the help of supervisely we can annotate our images very easily and after annotating our image we can easily train our data on any deep learning model without coding.
Supervisely是用于解決計(jì)算機(jī)視覺問題的Web平臺(tái)。 在監(jiān)督的幫助下,我們可以非常輕松地對(duì)圖像進(jìn)行注釋,并且在對(duì)圖像進(jìn)行注釋之后,我們可以輕松地在任何深度學(xué)習(xí)模型上訓(xùn)練數(shù)據(jù)而無需進(jìn)行編碼 。
Yes you read it write we can do any object detection task in supervisely without coding.
是的,您讀到它是寫的,我們無需編碼即可監(jiān)督任何對(duì)象檢測(cè)任務(wù)。
Supervisely Workflow監(jiān)督工作流程So we have discussed about all the tools and techniques. Let’s directly jump to the practical part.
因此,我們已經(jīng)討論了所有工具和技術(shù)。 讓我們直接跳到實(shí)際部分。
如何監(jiān)督使用Mask R-CNN進(jìn)行目標(biāo)檢測(cè)? (How to Use Mask R-CNN in Supervisely for Object Detection ?)
In this practical, I will be detecting road potholes by masking the detected area.
在本練習(xí)中,我將通過遮蓋檢測(cè)到的區(qū)域來檢測(cè)道路坑洼。
收集和注釋數(shù)據(jù)集 (Collecting and Annotating the Dataset)
I have collected the datasset from Kaggle’s Pothole image dataset. You can collect the dataset from here.
我已經(jīng)從Kaggle的Pothole圖片數(shù)據(jù)集中收集了數(shù)據(jù)集。 您可以從此處收集數(shù)據(jù)集。
Now let’s use supervisely for annotating the images. Before annotating let’s import the data in supervisely.
現(xiàn)在,讓我們監(jiān)督使用圖像批注。 在注釋之前,讓我們監(jiān)督導(dǎo)入數(shù)據(jù)。
First create a workspace in supervisely
首先在監(jiān)督下創(chuàng)建工作區(qū)
creating a workspace創(chuàng)建工作區(qū)Then import the data from your pc. For importing click on the import and then click the start import button.
然后從您的電腦導(dǎo)入數(shù)據(jù)。 對(duì)于導(dǎo)入,請(qǐng)單擊導(dǎo)入,然后單擊開始導(dǎo)入按鈕。
For annotating the images , click on projects >> Pothole dataset >>From the drop down menu click on Start annotation.
要為圖像添加注釋,請(qǐng)單擊項(xiàng)目>> Pothole數(shù)據(jù)集>>從下拉菜單中單擊開始注釋。
I will be using the Bitmap annotation. Now annotate only that area which you want to detect.
我將使用位圖注釋。 現(xiàn)在僅注釋要檢測(cè)的區(qū)域。
Bitmap annotation位圖注釋使用DTL進(jìn)行數(shù)據(jù)擴(kuò)充 (Data augmentation with DTL)
After annotating all the images it’s time to augment our data. Augmentation is a technique used for increasing the data samples by doing some small changes like horizontal flipping , vertical flipping , rotating , mirroring , shearing etc to the collected dataset.
在注釋完所有圖像之后,該增加數(shù)據(jù)了。 增強(qiáng)是一種通過對(duì)收集的數(shù)據(jù)集進(jìn)行一些小的更改(如水平翻轉(zhuǎn),垂直翻轉(zhuǎn),旋轉(zhuǎn),鏡像,剪切等)來增加數(shù)據(jù)樣本的技術(shù)。
In supervisely , I will take help of dtl(Data transformation language) for augmenting the data. You can refer the below json code as a dtl.
在監(jiān)督下,我將借助dtl(數(shù)據(jù)轉(zhuǎn)換語言)來增強(qiáng)數(shù)據(jù)。 您可以將以下json代碼稱為dtl。
select the run DTL option選擇運(yùn)行DTL選項(xiàng) DTL workflowDTL工作流程Now click the start button. After clicking we can see that a new images folder is created. So our Data augmentation part is done . Let’s move to the next part.
現(xiàn)在單擊開始按鈕。 單擊后,我們可以看到創(chuàng)建了一個(gè)新的圖像文件夾。 這樣我們的數(shù)據(jù)擴(kuò)充部分就完成了。 讓我們進(jìn)入下一部分。
帶有增強(qiáng)數(shù)據(jù)的訓(xùn)練蒙版-RCNN (Training Mask-RCNN with Augmented data)
I will be using the Mask-RCNN model for training the pothole images.
我將使用Mask-RCNN模型訓(xùn)練坑洼圖像。
So click on the neural network option , you will see the list of neural network models . Then Add the Mask-RCNN(keras+TF)(COCO) model.
因此,單擊神經(jīng)網(wǎng)絡(luò)選項(xiàng),您將看到神經(jīng)網(wǎng)絡(luò)模型的列表。 然后添加Mask-RCNN(keras + TF)(COCO)模型。
clone the neural network克隆神經(jīng)網(wǎng)絡(luò)Now train the neural network by clicking on Train button
現(xiàn)在,通過單擊“訓(xùn)練”按鈕來訓(xùn)練神經(jīng)網(wǎng)絡(luò)
But training our NN gives us error. It gives error because we haven’t given the required agents or the resources. I will be using the aws cloud to give proper agents
但是訓(xùn)練我們的神經(jīng)網(wǎng)絡(luò)會(huì)給我們帶來錯(cuò)誤。 由于我們沒有提供所需的代理或資源,因此產(chǎn)生錯(cuò)誤。 我將使用AWS云提供適當(dāng)?shù)拇?
Now click on the Cluster page link for creating a cluster
現(xiàn)在單擊“群集”頁面鏈接以創(chuàng)建群集
new cluster is created創(chuàng)建新集群 Requirements for our agent對(duì)我們代理商的要求使用AWS云實(shí)例來訓(xùn)練我們的模型 (Using Aws cloud instance for training our model)
For using aws services you must have an aws account.
要使用aws服務(wù),您必須具有aws帳戶。
For running an EC2 instance follow the below steps:
要運(yùn)行EC2實(shí)例,請(qǐng)執(zhí)行以下步驟:
3. We are going to select the GPU instance named as p2.xlarge
3.我們將選擇名為p2.xlarge的GPU實(shí)例。
4. Now go the configure instance and do the following configurations
4.現(xiàn)在轉(zhuǎn)到configure實(shí)例并執(zhí)行以下配置
5. Give a minimum of 90Gib storage.
5.至少提供90Gib的存儲(chǔ)空間。
6. Now after creating a key launch the instance. For logging into your instance use ssh command
6.現(xiàn)在,在創(chuàng)建密鑰后啟動(dòng)實(shí)例。 要登錄到您的實(shí)例,請(qǐng)使用ssh命令
instance is launched實(shí)例啟動(dòng)For training copy and paste the curl command from supervisely on our ec2 instance.
為了進(jìn)行訓(xùn)練,請(qǐng)?jiān)趀c2實(shí)例上監(jiān)督復(fù)制并粘貼curl命令。
Running the bash command運(yùn)行bash命令Wait for the complete setup to install
等待完整的安裝程序安裝
Now go to the supervisely train the Mask -RCNN model
現(xiàn)在去監(jiān)督訓(xùn)練Mask -RCNN模型
First all the images will be downloaded in our instance
首先,所有圖片將在我們的實(shí)例中下載
Model starts training模型開始訓(xùn)練We can also see the training graph and logs of our model
我們還可以看到我們模型的訓(xùn)練圖和日志
So after training your model don’t forget to stop your instance as aws charges on per hourly basis.
因此,在訓(xùn)練完模型之后,別忘了停止實(shí)例,因?yàn)锳WS每小時(shí)都會(huì)收費(fèi)。
Finally after training we can test our model by uploading some testing images. Here is the result of our model , I think it works pretty well.
最后,經(jīng)過訓(xùn)練,我們可以通過上傳一些測(cè)試圖像來測(cè)試模型。 這是我們模型的結(jié)果,我認(rèn)為它運(yùn)行良好。
Pothole image segmentation坑洼圖像分割感謝您的閱讀! (Thank you for reading!)
I hop you liked my article . Please clap , share and comment.
我希望你喜歡我的文章。 請(qǐng)鼓掌,分享和評(píng)論。
翻譯自: https://medium.com/swlh/instance-segmentation-using-mask-rcnn-f499bd4ed564
mask rcnn實(shí)例分割
總結(jié)
以上是生活随笔為你收集整理的mask rcnn实例分割_使用Mask-RCNN的实例分割的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Doinb金贡吐槽FPX冠军皮肤收益至今
- 下一篇: 使用FgSegNet进行前景图像分割