Run Mask RCNN code and stuck at “Converting sparse IndexedSlices to a dense Tensor of unknown shape”

痴心易碎 提交于 2021-01-29 21:16:13

问题


I'm new to Python and Tensorflow
Running Mask RCNN code from this tutorial and got stuck at
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "

Here's my configuration part of train.py shown as following

import os
import sys
import json
import datetime
import numpy as np
import skimage.draw
import cv2
from mrcnn.visualize import display_instances
import matplotlib.pyplot as plt

# Root directory of the project
ROOT_DIR = ""

# Import Mask RCNN
sys.path.append(ROOT_DIR)  # To find local version of the library
from mrcnn.config import Config
from mrcnn import model as modellib, utils

# Path to trained weights file
COCO_WEIGHTS_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5")

# Directory to save logs and model checkpoints, if not provided
# through the command line argument --logs
DEFAULT_LOGS_DIR = os.path.join(ROOT_DIR, "logs")

class CustomConfig(Config):
    """Configuration for training on the toy  dataset.
    Derives from the base Config class and overrides some values.
    """
    # Give the configuration a recognizable name
    NAME = "BH"

    # We use a GPU with 12GB memory, which can fit two images.
    # Adjust down if you use a smaller GPU.
    IMAGES_PER_GPU = 1

    # Number of classes (including background)
    NUM_CLASSES = 1 + 1  # Background + toy

    # Number of training steps per epoch
    STEPS_PER_EPOCH = 100

    # Skip detections with < 90% confidence
    DETECTION_MIN_CONFIDENCE = 0.9

I've waited for half an hour and seem like it can't get to the next step. Please give some suggestions.


回答1:


its not "stuck", its in training. Epoch 1/10 means its currently on the first epoch and there are 100 steps in an epoch, the speed of each epoch can vary according to different specifics in the code. For example

  • Are you using a GPU? If no then mask-rcnn training will be extremely slow.
  • What is your input image size? If its too large then the network will train slowly (Note: an arbitrarily large input image can be as small as 300x300 pixels)

You should know that even on GPU, often an epoch can take hours to train, if you're on CPU then that time can quadruple.

All in all, be patient. Its training.

Are you new to deep learning / computer vision as well, along with python and TF?



来源:https://stackoverflow.com/questions/60037586/run-mask-rcnn-code-and-stuck-at-converting-sparse-indexedslices-to-a-dense-tens

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!