mask rcnn实例分割_使用Mask-RCNN的实例分割
mask rcnn實例分割
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.
在本文中,我將創建自己的訓練有素的模型來檢測坑洼。 為了進行檢測,我將在Supervisely的幫助下使用Mask-RCNN使用實例分割技術。
Before creating our model lets get to know what tools and techniques we are using.
在創建模型之前,讓我們了解我們正在使用哪些工具和技術。
什么是實例細分? (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
實例分割是一種用于通過掩蔽或覆蓋檢測到的對象像素到像素來進行檢測的技術。 實例分割在自動駕駛汽車中非常有用,因為我們獲得了像素到像素的結果,這增加了較少事故的準確性
面罩-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是一個深度神經網絡,旨在解決機器學習或計算機視覺中的實例分割問題。 Mask RCNN有兩個階段。 首先,它基于輸入圖像生成有關可能存在對象的區域的建議。 其次,它根據第一階段的建議,預測對象的類別,優化邊界框并在對象的像素級別生成掩碼。
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實際上是經過訓練的模型,但是在本文中,我將向您展示如何為自己的自定義對象微調或訓練Mask-RCNN模型。
Mask-RCNN structureMask-RCNN結構什么是監督以及如何使用? (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是用于解決計算機視覺問題的Web平臺。 在監督的幫助下,我們可以非常輕松地對圖像進行注釋,并且在對圖像進行注釋之后,我們可以輕松地在任何深度學習模型上訓練數據而無需進行編碼 。
Yes you read it write we can do any object detection task in supervisely without coding.
是的,您讀到它是寫的,我們無需編碼即可監督任何對象檢測任務。
Supervisely Workflow監督工作流程So we have discussed about all the tools and techniques. Let’s directly jump to the practical part.
因此,我們已經討論了所有工具和技術。 讓我們直接跳到實際部分。
如何監督使用Mask R-CNN進行目標檢測? (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.
在本練習中,我將通過遮蓋檢測到的區域來檢測道路坑洼。
收集和注釋數據集 (Collecting and Annotating the Dataset)
I have collected the datasset from Kaggle’s Pothole image dataset. You can collect the dataset from here.
我已經從Kaggle的Pothole圖片數據集中收集了數據集。 您可以從此處收集數據集。
Now let’s use supervisely for annotating the images. Before annotating let’s import the data in supervisely.
現在,讓我們監督使用圖像批注。 在注釋之前,讓我們監督導入數據。
First create a workspace in supervisely
首先在監督下創建工作區
creating a workspace創建工作區Then import the data from your pc. For importing click on the import and then click the start import button.
然后從您的電腦導入數據。 對于導入,請單擊導入,然后單擊開始導入按鈕。
For annotating the images , click on projects >> Pothole dataset >>From the drop down menu click on Start annotation.
要為圖像添加注釋,請單擊項目>> Pothole數據集>>從下拉菜單中單擊開始注釋。
I will be using the Bitmap annotation. Now annotate only that area which you want to detect.
我將使用位圖注釋。 現在僅注釋要檢測的區域。
Bitmap annotation位圖注釋使用DTL進行數據擴充 (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.
在注釋完所有圖像之后,該增加數據了。 增強是一種通過對收集的數據集進行一些小的更改(如水平翻轉,垂直翻轉,旋轉,鏡像,剪切等)來增加數據樣本的技術。
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.
在監督下,我將借助dtl(數據轉換語言)來增強數據。 您可以將以下json代碼稱為dtl。
select the run DTL option選擇運行DTL選項 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.
現在單擊開始按鈕。 單擊后,我們可以看到創建了一個新的圖像文件夾。 這樣我們的數據擴充部分就完成了。 讓我們進入下一部分。
帶有增強數據的訓練蒙版-RCNN (Training Mask-RCNN with Augmented data)
I will be using the Mask-RCNN model for training the pothole images.
我將使用Mask-RCNN模型訓練坑洼圖像。
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.
因此,單擊神經網絡選項,您將看到神經網絡模型的列表。 然后添加Mask-RCNN(keras + TF)(COCO)模型。
clone the neural network克隆神經網絡Now train the neural network by clicking on Train button
現在,通過單擊“訓練”按鈕來訓練神經網絡
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
但是訓練我們的神經網絡會給我們帶來錯誤。 由于我們沒有提供所需的代理或資源,因此產生錯誤。 我將使用AWS云提供適當的代理
Now click on the Cluster page link for creating a cluster
現在單擊“群集”頁面鏈接以創建群集
new cluster is created創建新集群 Requirements for our agent對我們代理商的要求使用AWS云實例來訓練我們的模型 (Using Aws cloud instance for training our model)
For using aws services you must have an aws account.
要使用aws服務,您必須具有aws帳戶。
For running an EC2 instance follow the below steps:
要運行EC2實例,請執行以下步驟:
3. We are going to select the GPU instance named as p2.xlarge
3.我們將選擇名為p2.xlarge的GPU實例。
4. Now go the configure instance and do the following configurations
4.現在轉到configure實例并執行以下配置
5. Give a minimum of 90Gib storage.
5.至少提供90Gib的存儲空間。
6. Now after creating a key launch the instance. For logging into your instance use ssh command
6.現在,在創建密鑰后啟動實例。 要登錄到您的實例,請使用ssh命令
instance is launched實例啟動For training copy and paste the curl command from supervisely on our ec2 instance.
為了進行訓練,請在ec2實例上監督復制并粘貼curl命令。
Running the bash command運行bash命令Wait for the complete setup to install
等待完整的安裝程序安裝
Now go to the supervisely train the Mask -RCNN model
現在去監督訓練Mask -RCNN模型
First all the images will be downloaded in our instance
首先,所有圖片將在我們的實例中下載
Model starts training模型開始訓練We can also see the training graph and logs of our model
我們還可以看到我們模型的訓練圖和日志
So after training your model don’t forget to stop your instance as aws charges on per hourly basis.
因此,在訓練完模型之后,別忘了停止實例,因為AWS每小時都會收費。
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.
最后,經過訓練,我們可以通過上傳一些測試圖像來測試模型。 這是我們模型的結果,我認為它運行良好。
Pothole image segmentation坑洼圖像分割感謝您的閱讀! (Thank you for reading!)
I hop you liked my article . Please clap , share and comment.
我希望你喜歡我的文章。 請鼓掌,分享和評論。
翻譯自: https://medium.com/swlh/instance-segmentation-using-mask-rcnn-f499bd4ed564
mask rcnn實例分割
總結
以上是生活随笔為你收集整理的mask rcnn实例分割_使用Mask-RCNN的实例分割的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Doinb金贡吐槽FPX冠军皮肤收益至今
- 下一篇: 使用FgSegNet进行前景图像分割