onnx_model_zoo.sh 14.9 KB
Newer Older
M
Macrobull 已提交
1 2
#! /usr/bin/env sh

M
Macrobull 已提交
3 4
# setopt SH_WORD_SPLIT # if zsh

M
Macrobull 已提交
5
base_url="https://s3.amazonaws.com/download.onnx/models/opset_9/"
M
Macrobull 已提交
6 7 8 9 10 11 12
convert_flags="-e -o /tmp/export/"
validate_flags1="/tmp/export/model.py"
validate_flags2="/tmp/export/__model__"

# alias http_get="wget -c" # if no aria2
alias http_get="aria2c -c -s8 -x8"
# alias python="python3" # if ...
M
Macrobull 已提交
13

M
bugfix  
Macrobull 已提交
14

M
Macrobull 已提交
15 16
bvlc_alexnet()
{
M
bugfix  
Macrobull 已提交
17 18 19 20 21 22 23 24 25 26
	bn_tar="bvlc_alexnet"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
27
	for npz in "$bn_tar/"*.npz
M
bugfix  
Macrobull 已提交
28 29 30 31 32 33
	do
		echo "converting $npz ..."
		python convert_data_npz.py "$npz" data_0 prob_1 -s
		python -m onnx2fluid.validation $validate_flags1 -t "$npz"
		python -m onnx2fluid.validation $validate_flags2 -t "$npz"
	done
M
Macrobull 已提交
34
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
35 36 37 38 39 40 41 42
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
43 44 45 46
}

bvlc_googlenet()
{
M
bugfix  
Macrobull 已提交
47 48 49 50 51 52 53 54 55 56
	bn_tar="bvlc_googlenet"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
57
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
58 59 60 61 62 63 64 65
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
66 67 68 69
}

bvlc_reference_caffenet()
{
M
bugfix  
Macrobull 已提交
70 71 72 73 74 75 76 77 78 79
	bn_tar="bvlc_reference_caffenet"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
80
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
81 82 83 84 85 86 87 88
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
89 90 91 92
}

bvlc_reference_rcnn_ilsvrc13()
{
M
bugfix  
Macrobull 已提交
93 94 95 96 97 98 99 100 101 102
	bn_tar="bvlc_reference_rcnn_ilsvrc13"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
103
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 fc-rcnn_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

densenet121()
{
	bn_tar="densenet121"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
126
	for npz in "$bn_tar/"*.npz
M
bugfix  
Macrobull 已提交
127 128 129 130 131 132
	do
		echo "converting $npz ..."
		python convert_data_npz.py "$npz" data_0 fc6_1 -s
		python -m onnx2fluid.validation $validate_flags1 -t "$npz"
		python -m onnx2fluid.validation $validate_flags2 -t "$npz"
	done
M
Macrobull 已提交
133
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 fc6_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

   rm -rf "$bn_tar/"
}

emotion_ferplus()
{
	bn_tar="emotion_ferplus"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "https://onnxzoo.blob.core.windows.net/models/opset_8/emotion_ferplus/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
156
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
157 158 159 160 161 162 163 164
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" Input3 Plus692_Output_0
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
165 166 167 168
}

inception_v1()
{
M
bugfix  
Macrobull 已提交
169 170 171 172 173 174 175 176 177 178
	bn_tar="inception_v1"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
179
	for npz in "$bn_tar/"*.npz
M
bugfix  
Macrobull 已提交
180 181 182 183 184 185
	do
		echo "converting $npz ..."
		python convert_data_npz.py "$npz" data_0 prob_1 -s
		python -m onnx2fluid.validation $validate_flags1 -t "$npz"
		python -m onnx2fluid.validation $validate_flags2 -t "$npz"
	done
M
Macrobull 已提交
186
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
187 188 189 190 191 192 193 194
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
195 196 197 198
}

inception_v2()
{
M
bugfix  
Macrobull 已提交
199 200 201 202 203 204 205 206 207 208
	bn_tar="inception_v2"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
209
	for npz in "$bn_tar/"*.npz
M
bugfix  
Macrobull 已提交
210 211 212 213 214 215
	do
		echo "converting $npz ..."
		python convert_data_npz.py "$npz" data_0 prob_1 -s
		python -m onnx2fluid.validation $validate_flags1 -t "$npz"
		python -m onnx2fluid.validation $validate_flags2 -t "$npz"
	done
M
Macrobull 已提交
216
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

mobilenet()
{
	bn_tar="mobilenetv2-1.0"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
239
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data mobilenetv20_output_flatten0_reshape0
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

resnet18()
{
	bn_tar="resnet18v1"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v1/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
262
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
263 264 265 266 267 268 269 270
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data resnetv15_dense0_fwd
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
271 272 273 274
}

resnet50()
{
M
bugfix  
Macrobull 已提交
275 276 277 278 279 280 281 282 283 284
	bn_tar="resnet50"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
285
	for npz in "$bn_tar/"*.npz
M
bugfix  
Macrobull 已提交
286 287 288 289 290 291
	do
		echo "converting $npz ..."
		python convert_data_npz.py "$npz" gpu_0/data_0 gpu_0/softmaxout_1 -s
		python -m onnx2fluid.validation $validate_flags1 -t "$npz"
		python -m onnx2fluid.validation $validate_flags2 -t "$npz"
	done
M
Macrobull 已提交
292
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" gpu_0/data_0 gpu_0/softmaxout_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

resnet100_arcface()
{
	bn_tar="resnet100"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/arcface/resnet100/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

M
Macrobull 已提交
314
	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
315
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data fc1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

resnet101_duc()
{
	bn_tar="ResNet101_DUC_HDC"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/duc/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
338
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data seg_loss
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

resnet152()
{
	bn_tar="resnet152v2"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet152v2/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
361
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
362 363 364 365 366 367 368 369
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data resnetv27_dense0_fwd
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
370 371 372 373
}

shufflenet()
{
M
bugfix  
Macrobull 已提交
374 375 376 377 378 379 380 381 382 383
	bn_tar="shufflenet"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
384
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
385 386 387 388 389 390 391 392
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" gpu_0/data_0 gpu_0/softmax_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
393 394 395 396
}

squeezenet()
{
M
bugfix  
Macrobull 已提交
397 398 399 400 401 402 403 404 405 406
	bn_tar="squeezenet"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
407
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 softmaxout_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

squeezenet1v1()
{
	bn_tar="squeezenet1.1"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/squeezenet/squeezenet1.1/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
430
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data squeezenet0_flatten0_reshape0
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

ssd()
{
	bn_tar="ssd"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "https://onnxzoo.blob.core.windows.net/models/opset_10/ssd/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	mkdir "$bn_tar"
M
Macrobull 已提交
451
	tar xf "$fn_tar" -C "$bn_tar/"
M
bugfix  
Macrobull 已提交
452 453

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
454
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
455 456 457 458 459 460 461 462
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" image bboxes,labels,scores
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
463 464 465 466
}

tiny_yolov2()
{
M
bugfix  
Macrobull 已提交
467 468 469 470 471 472 473 474 475 476
	bn_tar="tiny_yolov2"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "https://onnxzoo.blob.core.windows.net/models/opset_8/tiny_yolov2/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
477
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" image grid
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

vgg16bn()
{
	bn_tar="vgg16-bn"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/$bn_tar.onnx"

	http_get "https://s3.amazonaws.com/onnx-model-zoo/vgg/vgg16-bn/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -y
M
Macrobull 已提交
500
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
501 502 503 504 505 506 507 508
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" data vgg0_dense2_fwd
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
509 510 511 512
}

vgg19()
{
M
bugfix  
Macrobull 已提交
513 514 515 516 517 518 519 520 521 522
	bn_tar="vgg19"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
523
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" data_0 prob_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
}

yolov3()
{
	bn_tar="yolov3"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "https://onnxzoo.blob.core.windows.net/models/opset_10/yolov3/$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model" -x #
M
Macrobull 已提交
546
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
547 548 549 550 551 552 553 554
	do
		echo "converting $pb_dir ..."
		python convert_data_pb.py "$pb_dir" input_1:01,image_shape:01 yolonms_layer_1/ExpandDims_1:0,yolonms_layer_1/ExpandDims_3:0,yolonms_layer_1/concat_2:0
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
555 556 557 558
}

zfnet512()
{
M
bugfix  
Macrobull 已提交
559 560 561 562 563 564 565 566 567 568
	bn_tar="zfnet512"
	fn_tar="$bn_tar.tar.gz"
	fn_model="$bn_tar/model.onnx"

	http_get "$base_url$fn_tar"
	rm -rf "$bn_tar/"
	echo "extracting ..."
	tar xf "$fn_tar"

	python -m onnx2fluid $convert_flags "$fn_model"
M
Macrobull 已提交
569
	for pb_dir in "$bn_tar/"*/
M
bugfix  
Macrobull 已提交
570 571 572 573 574 575 576 577
	do
		echo "converting $pb_dir"
		python convert_data_pb.py "$pb_dir" gpu_0/data_0 gpu_0/softmax_1
		python -m onnx2fluid.validation $validate_flags1 -t $(dirname "$pb_dir/x").npz
		python -m onnx2fluid.validation $validate_flags2 -t $(dirname "$pb_dir/x").npz
	done

	rm -rf "$bn_tar/"
M
Macrobull 已提交
578 579 580
}


M
Macrobull 已提交
581 582
bvlc_alexnet
bvlc_googlenet
M
Macrobull 已提交
583 584
bvlc_reference_caffenet
bvlc_reference_rcnn_ilsvrc13
M
bugfix  
Macrobull 已提交
585 586
densenet121
emotion_ferplus # not supported
M
Macrobull 已提交
587 588
inception_v1
inception_v2
M
bugfix  
Macrobull 已提交
589 590
mobilenet
resnet18
M
Macrobull 已提交
591
resnet50
M
bugfix  
Macrobull 已提交
592 593 594
resnet100_arcface
resnet101_duc
resnet152
M
Macrobull 已提交
595
shufflenet
M
Macrobull 已提交
596
squeezenet # softmax bug
M
bugfix  
Macrobull 已提交
597 598 599 600
squeezenet1v1
ssd # version not supported
tiny_yolov2 # not supported
vgg16bn
M
Macrobull 已提交
601
vgg19
M
bugfix  
Macrobull 已提交
602
yolov3 # malformed model ?
M
Macrobull 已提交
603
zfnet512