Skip to content

Commit

Permalink
fix import in ipynb, clear init, minor upadte by comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored and waleedka committed Apr 6, 2018
1 parent 1afcbb5 commit 87c4f74
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 45 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,6 @@ All required packages are listed in standard file:
pip3 install -r requirements.txt
```

## Installation

The installation as possible using following command:
```bash
python3 setup.py build_ext --inplace
python3 setup.py install
```

### MS COCO Requirements:
To train or test on MS COCO, you'll also need:
* pycocotools (installation instructions below)
Expand All @@ -188,7 +180,10 @@ If you use Docker, the code has been verified to work on


## Installation
1. Clone this repository
1. Clone this repository. The installation as possible using following command:
```bash
python3 setup.py install
```
2. Download pre-trained COCO weights (mask_rcnn_coco.h5) from the [releases page](https://github.com/matterport/Mask_RCNN/releases).
3. (Optional) To train or test on MS COCO install `pycocotools` from one of these repos. They are forks of the original pycocotools with fixes for Python3 and Windows (the official repo doesn't seem to be active anymore).
Expand Down
17 changes: 0 additions & 17 deletions mrcnn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
import os
import logging

import matplotlib
import numpy as np

# in case you are running on machine without display, e.g. server
if os.environ.get('DISPLAY', '') == '' \
and matplotlib.rcParams['backend'] != 'agg':
logging.warning('No display found. Using non-interactive Agg backend')
# https://matplotlib.org/faq/usage_faq.html
matplotlib.use('Agg')

# parse the numpy versions
np_version = [int(i) for i in np.version.full_version.split('.')]
# comparing strings does not work for version lower 1.10
if np_version >= [1, 14]:
np.set_printoptions(legacy='1.13')
2 changes: 1 addition & 1 deletion mrcnn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,7 @@ def find_last(self):
dir_name = os.path.join(self.model_dir, dir_names[-1])
# Find the last checkpoint
checkpoints = next(os.walk(dir_name))[2]
checkpoints = filter(lambda f: f.startswith("mrcnn"), checkpoints)
checkpoints = filter(lambda f: f.startswith("mask_rcnn"), checkpoints)
checkpoints = sorted(checkpoints)
if not checkpoints:
return dir_name, None
Expand Down
14 changes: 12 additions & 2 deletions mrcnn/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
Written by Waleed Abdulla
"""

import os
import logging
import random
import itertools
import colorsys

import matplotlib
# in case you are running on machine without display, e.g. server
if os.environ.get('DISPLAY', '') == '' \
and matplotlib.rcParams['backend'] != 'agg':
logging.warning('No display found. Using non-interactive Agg backend')
# https://matplotlib.org/faq/usage_faq.html
matplotlib.use('Agg')

import numpy as np
from skimage.measure import find_contours
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.lines as lines
from matplotlib import patches, lines
from matplotlib.patches import Polygon
import IPython.display

Expand Down
6 changes: 3 additions & 3 deletions samples/balloon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ Open the `inspect_balloon_data.ipynb` or `inspect_balloon_model.ipynb` Jupter no
## Train the Balloon model

Train a new model starting from pre-trained COCO weights
```bash
```
python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=coco
```

Resume training a model that you had trained earlier
```bash
```
python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=last
```

Train a new model starting from ImageNet weights
```bash
```
python3 balloon.py train --dataset=/path/to/balloon/dataset --weights=imagenet
```

Expand Down
4 changes: 2 additions & 2 deletions samples/balloon/inspect_balloon_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"\n",
"# Import Mask RCNN\n",
"sys.path.append(ROOT_DIR)\n",
"import mrcnn.utils\n",
"import mrcnn.visualize\n",
"from mrcnn import utils\n",
"from mrcnn import visualize\n",
"from mrcnn.visualize import display_images\n",
"import mrcnn.model as modellib\n",
"from mrcnn.model import log\n",
Expand Down
4 changes: 2 additions & 2 deletions samples/balloon/inspect_balloon_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"\n",
"# Import Mask RCNN\n",
"sys.path.append(ROOT_DIR)\n",
"import mrcnn.utils\n",
"import mrcnn.visualize\n",
"from mrcnn import utils\n",
"from mrcnn import visualize\n",
"from mrcnn.visualize import display_images\n",
"import mrcnn.model as modellib\n",
"from mrcnn.model import log\n",
Expand Down
4 changes: 2 additions & 2 deletions samples/inspect_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"import matplotlib.lines as lines\n",
"from matplotlib.patches import Polygon\n",
"\n",
"import mrcnn.utils\n",
"import mrcnn.visualize\n",
"from mrcnn import utils\n",
"from mrcnn import visualize\n",
"from mrcnn.visualize import display_images\n",
"import mrcnn.model as modellib\n",
"from mrcnn.model import log\n",
Expand Down
4 changes: 2 additions & 2 deletions samples/inspect_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"import matplotlib.pyplot as plt\n",
"import matplotlib.patches as patches\n",
"\n",
"import mrcnn.utils\n",
"import mrcnn.visualize\n",
"from mrcnn import utils\n",
"from mrcnn import visualize\n",
"from mrcnn.visualize import display_images\n",
"import mrcnn.model as modellib\n",
"from mrcnn.model import log\n",
Expand Down
4 changes: 2 additions & 2 deletions samples/inspect_weights.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"import matplotlib.pyplot as plt\n",
"import keras\n",
"\n",
"import mrcnn.utils\n",
"from mrcnn import utils\n",
"import mrcnn.model as modellib\n",
"import mrcnn.visualize\n",
"from mrcnn import visualize\n",
"from mrcnn.model import log\n",
"\n",
"%matplotlib inline \n",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions samples/train_shapes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from mrcnn.config import Config\n",
"import mrcnn.utils\n",
"from mrcnn import utils\n",
"import mrcnn.model as modellib\n",
"import mrcnn.visualize\n",
"from mrcnn import visualize\n",
"from mrcnn.model import log\n",
"\n",
"%matplotlib inline \n",
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The build/compilations setup
>> pip install -r requirements.txt
>> python setup.py build_ext --inplace
>> python setup.py install
For uploading to PyPi follow instructions
Expand Down

0 comments on commit 87c4f74

Please sign in to comment.