retinaface icon indicating copy to clipboard operation
retinaface copied to clipboard

how to convert mnet.25.prototxt and mnet.25.caffemodel to mnet-deconv.prototxt and mnet-deconv.caffemodel

Open Royzon opened this issue 5 years ago • 7 comments

Thanks for your sharing. I convert mnet.25 mxnet model to caffe model successfully by your tools, but I find this caffe model can't used in your project directly, so may you pleasure to help me solve it?

Royzon avatar Sep 03 '19 06:09 Royzon

what's your problems?

clancylian avatar Sep 04 '19 07:09 clancylian

the error message is here: [100%] Linking CXX executable retinaface [100%] Built target retinaface batchSize:1, channel:3, netHeight:416, netWidth:288. Caffe Parser: Invalid axis in crop layer - only spatial cropping is supported error parsing layer type Crop index 143 retinaface: retinaface/tensorrt/trtnetbase.cpp:279: void TrtNetBase::caffeToTRTModel(const string&, const string&, nvcaffeparser1::IPluginFactory*): Assertion `blobNameToTensor != nullptr' failed. Aborted (core dumped)

and I find there are many differences, why the converted model can not be used directly? $ diff mnet25.prototxt mnet-deconv-0517.prototxt 7c7 < shape: { dim: 1 dim: 3 dim: 416 dim: 288 }

shape: { dim: 1 dim: 3 dim: 320 dim: 320 }

1208a1209

  bias_term: true

1247a1249

  bias_term: true

1279a1282

  bias_term: true

1318a1322

  bias_term: true

1350a1355

  bias_term: true

1389a1395

  bias_term: true

1437a1444

  bias_term: true

1448,1453c1455,1460 < dim: 2 < dim: -1 < dim: 0 < } < axis: 1
< }

  dim:0
  dim:2
  dim:-1
  dim:0
 }

} 1470,1475c1477,1482 < dim: 4 < dim: -1 < dim: 0 < } < axis: 1
< }


  dim:0
  dim:4
  dim:-1
  dim:0
 }

} 1487a1495 bias_term: true 1500a1509 bias_term: true 1513a1523 bias_term: true 1544,1545d1553 < bottom: "rf_c3_lateral_relu" < top: "rf_c3_upsampling" 1547a1556,1557 bottom: "rf_c3_lateral_relu" top: "rf_c3_upsampling" 1549,1556c1559,1566 < num_output: 64 < kernel_size: 4 < stride: 2 < pad: 1 < group: 64 < bias_term: false < weight_filler: { < type: "bilinear"


  kernel_size: 4
  stride: 2
  pad: 1
  num_output: 64
  group: 64
  bias_term: false
  weight_filler {
 type: "bilinear"

1558a1569

param { lr_mult: 0 decay_mult: 0 } 1568,1569c1579 < axis: 1 < offset: 0


  axis: 2

1593a1604

  bias_term: true

1632a1644

  bias_term: true

1664a1677

  bias_term: true

1703a1717

  bias_term: true

1735a1750

  bias_term: true

1774a1790

  bias_term: true

1822a1839

  bias_term: true

1833,1838c1850,1855 < dim: 2 < dim: -1 < dim: 0 < } < axis: 1
< }

  dim:0
  dim:2
  dim:-1
  dim:0
 }

} 1855,1860c1872,1877 < dim: 4 < dim: -1 < dim: 0 < } < axis: 1
< }


  dim:0
  dim:4
  dim:-1
  dim:0
 }

} 1872a1890 bias_term: true 1885a1904 bias_term: true 1898a1918 bias_term: true 1929,1930d1948 < bottom: "rf_c2_aggr_relu" < top: "rf_c2_upsampling" 1932a1951,1952 bottom: "rf_c2_aggr_relu" top: "rf_c2_upsampling" 1934,1941c1954,1961 < num_output: 64 < kernel_size: 4 < stride: 2 < pad: 1 < group: 64 < bias_term: false < weight_filler: { < type: "bilinear"


  kernel_size: 4
  stride: 2
  pad: 1
  num_output: 64
  group: 64
  bias_term: false
  weight_filler {
 type: "bilinear"

1943a1964

param { lr_mult: 0 decay_mult: 0 } 1953,1954c1974 < axis: 1 < offset: 0


  axis: 2

1978a1999

  bias_term: true

2017a2039

  bias_term: true

2049a2072

  bias_term: true

2088a2112

  bias_term: true

2120a2145

  bias_term: true

2159a2185

  bias_term: true

2207a2234

  bias_term: true

2218,2223c2245,2250 < dim: 2 < dim: -1 < dim: 0 < } < axis: 1
< }

  dim:0
  dim:2
  dim:-1
  dim:0
 }

} 2240,2245c2267,2272 < dim: 4 < dim: -1 < dim: 0 < } < axis: 1
< }


  dim:0
  dim:4
  dim:-1
  dim:0
 }

} 2257a2285 bias_term: true 2270a2299 bias_term: true

Royzon avatar Sep 05 '19 06:09 Royzon

can you use caffe model directly instead of use tensorRT model ? if caffe model is not occur error , you should set shape in .prototxt the same as the code.

clancylian avatar Sep 05 '19 06:09 clancylian

can you use caffe model directly instead of use tensorRT model ? if caffe model is not occur error , you should set shape in .prototxt the same as the code.

我自己训的模型怎么能变成mnet-deconv那样,转换的时候报错: Caffe Parser: Invalid axis in crop layer - only spatial cropping is supported

flazerain avatar Nov 29 '19 02:11 flazerain

@Royzon Hi where did you download the mobilenet25 mxnet model?could you give me the website?thank u

nuanxinqing avatar Mar 21 '20 07:03 nuanxinqing

@clancylian , I encountered this error when I tried using your mnet25.caffemodel and ment25.prototxt to do inferencing on DeepStream. Deepstream auto convert the caffe model to tensorRT by generating engine plan file. The caffe model itself is working fine, the error occurs when it comes to tensorRT. Any thoughts on what might be the reason? Thanks

JaydonChion avatar Oct 15 '20 14:10 JaydonChion

@JaydonChion have you solve this?

qustions avatar Dec 16 '20 20:12 qustions