Open dl19940602 opened 5 years ago
@xchani
Got exactly the same exception:
mxnet.base.MXNetError: [08:59:39] src/operator/nn/./../tensor/../elemwise_op_common.h:135: Check failed: assign(&dattr, vec.at(i)): Incompatible attr in node at 0-th output: expected [1,64,1,1], got [64]
While just running rpn_test.py on trained (MSCOCO) tridentnet_r101v2c4_c5_2x checkpoint. detection_train and detection_test work fine.
Bug confirmed. It seems we forget to add graph optimization for rpn_test.
@dl19940602 Hi, how to test with multi-sacle on one image?
他的代码不能用,骗人的
Hi, I try to detection one image,I debug the following code, but meet the Error,my command is
python simpledet-test1.py --config config/resnet_v1b/tridentnet_r50v1bc4_c5_1x.py --inputs data/nanchang_20180209_JPEGImages_58215.jpg
mxnet.base.MXNetError: [08:59:39] src/operator/nn/./../tensor/../elemwise_op_common.h:135: Check failed: assign(&dattr, vec.at(i)): Incompatible attr in node at 0-th output: expected [1,64,1,1], got [64]
How can i deal with it?
code: import os, argparse import importlib import json import time import cv2 import numpy as np import mxnet as mx from core.detection_module import DetModule from utils.load_model import load_checkpoint
coco = ( 'person', 'bicycle', 'car', 'tricycle')
class TDNDetector: def init(self, configFn, ctx, outFolder, threshold): os.environ["MXNET_CUDNN_AUTOTUNE_DEFAULT"] = "0" config = importlib.importmodule(configFn.replace('.py', '').replace('/', '.')) ,,,,,_, self.pModel,_, self.pTest,,,, = config.get_config(is_train=False) if callable(self.pTest.nms.type): self.nms = self.pTest.nms.type(self.__pTest.nms.thr) else: from operator_py.nms import py_nms_wrapper self.nms = py_nms_wrapper(self.pTest.nms.thr) arg_params, aux_params = load_checkpoint(self.pTest.model.prefix, self.pTest.model.epoch) sym = self.__pModel.test_symbol self.mod = DetModule(sym, data_names=['data','im_info','im_id','rec_id'], context=ctx) self.__mod.bind(data_shapes=[('data', (1, 3, 600, 899)), ('im_info', (1, 3)), ('im_id', (1,)), ('rec_id', (1,))], for_training=False) self.mod.set_params(arg_params, aux_params, allow_extra=False) self.saveSymbol(sym, outFolder, self.pTest.model.prefix.split('/')[-1]) self.threshold = threshold
def parse_args(): parser = argparse.ArgumentParser(description='Test Detection') parser.add_argument('--config', type=str, required=True, help='config file path') parser.add_argument('--ctx', type=int, default=0, help='GPU index. Set negative value to use CPU') parser.add_argument('--inputs', type=str, nargs='+', required=True, help='File(-s) to test') parser.add_argument('--output', type=str, default='results', help='Where to store results') parser.add_argument('--threshold', type=float, default=0.5, help='Detector threshold') return parser.parse_args()
if name == "main": args = parse_args()
ctx = mx.gpu(args.ctx) if args.ctx>=0 else args.cpu() imgFilenames = args.inputs detector = TDNDetector(args.config, ctx, args.output, args.threshold) for i, imgFilename in enumerate(imgFilenames): dets, img = detector(imgFilename)