bendangnuksung / mrcnn_serving_ready

🛠 Mask R-CNN Keras to Tensorflow and TFX models + Serving models using TFX GRPC & RESTAPI
https://github.com/matterport/Mask_RCNN
MIT License
103 stars 35 forks source link

my customed config #7

Closed lunasdejavu closed 5 years ago

lunasdejavu commented 5 years ago

I put my custom config in the beginning main.py

class ShapesConfig(mask_config):
    """Configuration for training on the toy shapes dataset.
    Derives from the base Config class and overrides values specific
    to the toy shapes dataset.
    """
    # Give the configuration a recognizable name
    NAME = "Newton Ring"
    BACKBONE = "resnet50"
    # Train on 1 GPU and 8 images per GPU. We can put multiple images on each
    # GPU because the images are small. Batch size is 8 (GPUs * images/GPU).
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1

    # Number of classes (including background)
    NUM_CLASSES = 1 + 1  # background + 3 shapes

    # Use small images for faster training. Set the limits of the small side
    # the large side, and that determines the image shape.
    IMAGE_MIN_DIM = 1024
    IMAGE_MAX_DIM = 1024

    qq = 4
    # Use smaller anchors because our image and objects are small
    RPN_ANCHOR_SCALES = (8 * qq, 16 * qq, 32 * qq, 64 * qq, 128 * qq) #(32, 64, 128, 256, 512

    # Reduce training ROIs per image because the images are small and have
    # few objects. Aim to allow ROI sampling to pick 33% positive ROIs.
    TRAIN_ROIS_PER_IMAGE = 64

    # Use a small epoch since the data is simple
    STEPS_PER_EPOCH = 890

    # use small validation steps since the epoch is small
    VALIDATION_STEPS = 111    
    # iter_num 
    iter_num = 0
    DETECTION_MIN_CONFIDENCE = 0.81

then config = ShapesConfig()

the error is like :

    config = ShapesConfig()
TypeError: __init__() missing 1 required positional argument: 'NUMBER_OF_CLASSES'

what is wrong with it?

bendangnuksung commented 5 years ago

Did you replace your custom config in main.py, current line no: 103. i.e 'config = get_config()' ?

lunasdejavu commented 5 years ago

ya, I used config = ShapesConfig(2) since the number of my class is only 1 +background I am keeping trying now, btw what is the VESRION_NUMBERmeans in user_config.py?

lunasdejavu commented 5 years ago

the frozen_graph.pb can be saved now but too bad I can't read it by opencv 4.1 cv::dnn::readNet() :(

bendangnuksung commented 5 years ago

Glad it worked. Do let me know if you find a workaround with opencv load model. As for now closing the issue.