-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final Experimental to stable Merge pull request #7 from AdrienJaugey/…
…experimental Final Experimental to stable merge
- Loading branch information
Showing
49 changed files
with
3,100 additions
and
1,012 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Mask R-CNN | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Matterport, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "KqzoydcMBgc-" | ||
}, | ||
"source": [ | ||
"# Mask R-CNN - ASAP Annotations Fusion" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "Tu0r49kND1_z" | ||
}, | ||
"source": [ | ||
"## Initialisation" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "fA4OVDl3D5zL" | ||
}, | ||
"source": [ | ||
"### Detecting Environment" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "1JnPwYerzUO4" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import sys\n", | ||
"IN_COLAB = 'google.colab' in sys.modules\n", | ||
"print(\"Executing in Google Colab\" if IN_COLAB else \"Executing locally\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "LXIK5fcSD9Xq" | ||
}, | ||
"source": [ | ||
"### Getting all the needed files" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "wa3F4QvMxmCE" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"if IN_COLAB:\n", | ||
" import shutil\n", | ||
" shutil.rmtree('sample_data/', ignore_errors=True)\n", | ||
" import os\n", | ||
" GITHUB_REPO = \"https://raw.githubusercontent.com/AdrienJaugey/Custom-Mask-R-CNN-for-kidney-s-cell-recognition/experimental/\"\n", | ||
" files = ['mrcnn/TensorflowDetector.py', 'mrcnn/utils.py', 'mrcnn/visualize.py', 'mrcnn/post_processing.py',\n", | ||
" 'mrcnn/Config.py', 'mrcnn/statistics.py', 'datasetTools/datasetDivider.py', 'common_utils.py',\n", | ||
" 'datasetTools/datasetWrapper.py', 'datasetTools/datasetIsolator.py', 'datasetTools/AnnotationAdapter.py',\n", | ||
" 'datasetTools/ASAPAdapter.py', 'datasetTools/LabelMeAdapter.py', 'datasetTools/CustomDataset.py']\n", | ||
" for fileToDownload in files:\n", | ||
" url = GITHUB_REPO + fileToDownload\n", | ||
" !wget -qN $url\n", | ||
" if '/' in fileToDownload:\n", | ||
" destDir = fileToDownload.split('/')[0]\n", | ||
" fileName = fileToDownload.split('/')[1].replace('/', '')\n", | ||
" os.makedirs(destDir, exist_ok=True)\n", | ||
" !mv $fileName $fileToDownload" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"if IN_COLAB:\n", | ||
" from google.colab import drive\n", | ||
" drive.mount('/content/drive')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "w-I3GmFGEqUQ" | ||
}, | ||
"source": [ | ||
"## Annotations fusion" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"pycharm": { | ||
"name": "#%%\n" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"from datasetTools import AnnotationAdapter\n", | ||
"from datasetTools.ASAPAdapter import ASAPAdapter as a\n", | ||
"from common_utils import progressBar" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Please set ```firstAnnotationsDir```, ```secondAnnotationsDir``` and ```outputAnnotationsDir``` before executing the cell." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"firstAnnotationsDir = \"annotations_in_1/\" #@param {type:\"string\"}\n", | ||
"secondAnnotationsDir = \"annotations_in_2/\" #@param {type:\"string\"}\n", | ||
"outputAnnotationsDir = \"annotations_out/\" #@param {type:\"string\"}\n", | ||
"if IN_COLAB:\n", | ||
" firstAnnotationsDir = os.path.join('drive/MyDrive', firstAnnotationsDir)\n", | ||
" secondAnnotationsDir = os.path.join('drive/MyDrive', secondAnnotationsDir)\n", | ||
" outputAnnotationsDir = os.path.join('drive/MyDrive', outputAnnotationsDir)\n", | ||
"firstAnnotationsDir = os.path.normpath(firstAnnotationsDir)\n", | ||
"secondAnnotationsDir = os.path.normpath(secondAnnotationsDir)\n", | ||
"outputAnnotationsDir = os.path.normpath(outputAnnotationsDir)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "Z6OOmdASyMvJ", | ||
"pycharm": { | ||
"name": "#%%\n" | ||
}, | ||
"scrolled": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"firstDirList = os.listdir(firstAnnotationsDir)\n", | ||
"secondDirList = os.listdir(secondAnnotationsDir)\n", | ||
"files = [file for file in firstDirList if file in secondDirList]\n", | ||
"total = len(files)\n", | ||
"if not os.path.exists(outputAnnotationsDir):\n", | ||
" os.makedirs(outputAnnotationsDir)\n", | ||
"for idx, file in enumerate(files):\n", | ||
" progressBar(idx + 1, total, prefix=\"Fusing annotations\", suffix=f\"Current file : {file}\")\n", | ||
" a.fuseAnnotationsFiles([os.path.join(folder, file) for folder in [firstAnnotationsDir, secondAnnotationsDir]],\n", | ||
" os.path.join(outputAnnotationsDir, file))\n", | ||
"print(\"\\nDone !\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"colab": { | ||
"authorship_tag": "ABX9TyOHBS6d5l6TXpghydDsqc9D", | ||
"collapsed_sections": [], | ||
"name": "Mask_R_CNN_Stats_Extractor.ipynb", | ||
"provenance": [], | ||
"toc_visible": true | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 1 | ||
} |
Oops, something went wrong.