Open jeansely opened 7 years ago
This is what the code is trying to execute: Net('TVG_CRFRNN_new_deploy.prototxt', 1, weights='TVG_CRFRNN_COCO_VOC.caffemodel')
This is the error message: Error parsing text-format caffe.NetParameter: 619:31: Message type "caffe.LayerParameter" has no field named "multi_stage_meanfield_param". F0207 06:27:00.273581 11944 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: TVG_CRFRNN_new_deploy.prototxt
Apparently, the model definitions (specified as: TVG_CRFRNN_new_deploy.prototxt) do not match with the pre-trained weight network format (in: TVG_CRFRNN_COCO_VOC.caffemodel) and that's why the error. It can't read the final layer.
Not sure what has happened. From my reading over various sites, this is possible due to that the Caffe Windows does not support RNN. I am going to try this in Linux or Mac to see if it works.
I did try to remove the last layer in the TVG_CRFRNN_new_deploy.prototxt. It did work without error but the results looked quite funny.
i am using cpu with; 32G RAM & 32 CORE CPU & WINDOWS OS
when the code start this line ; net = caffe.Net(model_def_file, model_file, caffe.TEST) the python has stopped working . the code is ; import sys import time import getopt import os import numpy as np from PIL import Image as PILImage
Path of the Caffe installation.
_CAFFE_ROOT = "C:\Program Files\python3.5\python-3.5.3.amd64\Lib\site-packages\caffe"
Model definition and model file paths
_MODEL_DEF_FILE = 'C:/cnn/crfasrnn_caffe/python-scripts/TVG_CRFRNN_new_deploy.prototxt' # Contains the network definition _MODEL_FILE = 'C:/cnn/crfasrnn_caffe/python-scripts/TVG_CRFRNN_COCO_VOC.caffemodel' # Contains the trained weights. Download from http://goo.gl/j7PrPZ
sys.path.insert(0, _CAFFE_ROOT + "python") import caffe
_MAX_DIM = 100
def get_palette(num_cls): """ Returns the color map for visualizing the segmentation mask.
def crfrnn_segmenter(model_def_file, model_file, gpu_device, inputs):
def run_crfrnn(input_file, output_file, gpu_device = -1): """ Runs the CRF-RNN segmentation on the given RGB image and saves the segmentation mask.
def resize_image(image): """ Resizes the image so that the largest dimension is not larger than 500 pixels. If the image's largest dimension is already less than 500, no changes are made.
def main(argv): """ Main entry point to the program. """
if name == "main": main(sys.argv[1:])