Skip to content

Instantly share code, notes, and snippets.

@emadehsan
Created January 29, 2020 15:37
Show Gist options
  • Select an option

  • Save emadehsan/137c6fe4bd0e937b82afc978e8484ad3 to your computer and use it in GitHub Desktop.

Select an option

Save emadehsan/137c6fe4bd0e937b82afc978e8484ad3 to your computer and use it in GitHub Desktop.
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
# Root directory of the project
ROOT_DIR = os.path.abspath("./Mask_RCNN/")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn import utils
import mrcnn.model as modellib
from mrcnn import visualize
# Import COCO config
sys.path.append(os.path.join(ROOT_DIR, "samples/coco/")) # find local version
import coco
%matplotlib inline
# Directory to save logs and trained model
MODEL_DIR = os.path.join(ROOT_DIR, "logs")
# Local path to trained weights file
COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5")
# Download COCO trained weights from Releases if needed
if not os.path.exists(COCO_MODEL_PATH):
utils.download_trained_weights(COCO_MODEL_PATH)
# Directory of images to run detection on
IMAGE_DIR = os.path.join(ROOT_DIR, "images")
@lfleon9b

lfleon9b commented Feb 8, 2020

Copy link
Copy Markdown

Great, thanks for share!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment