@@ -353,37 +353,8 @@ def fit_to_input(self, data, layer_name, layout, precision, template=None):
353
353
data = data .astype (precision )
354
354
return data
355
355
356
- def prepare_model (self , launcher ):
357
- launcher_specific_entries = [
358
- 'model' , 'weights' , 'caffe_model' , 'caffe_weights' , 'tf_model' , 'inputs' , 'outputs' , '_model_optimizer'
359
- ]
360
-
361
- def update_mo_params (launcher_config , model_config ):
362
- for entry in launcher_specific_entries :
363
- if entry not in launcher_config :
364
- continue
365
- if entry in model_config :
366
- continue
367
- model_config [entry ] = launcher_config [entry ]
368
- model_mo_flags , model_mo_params = model_config .get ('mo_flags' , []), model_config .get ('mo_params' , {})
369
- launcher_mo_flags , launcher_mo_params = launcher_config .get ('mo_flags' , []), launcher_config .get (
370
- 'mo_params' , {})
371
- for launcher_flag in launcher_mo_flags :
372
- if launcher_flag not in model_mo_flags :
373
- model_mo_flags .append (launcher_flag )
374
-
375
- for launcher_mo_key , launcher_mo_value in launcher_mo_params .items ():
376
- if launcher_mo_key not in model_mo_params :
377
- model_mo_params [launcher_mo_key ] = launcher_mo_value
378
-
379
- model_config ['mo_flags' ] = model_mo_flags
380
- model_config ['mo_params' ] = model_mo_params
381
-
382
- update_mo_params (launcher .config , self .model_info )
383
- if 'caffe_model' in self .model_info :
384
- model , weights = launcher .convert_model (self .model_info )
385
- else :
386
- model , weights = self .auto_model_search (self .model_info )
356
+ def prepare_model (self ):
357
+ model , weights = self .auto_model_search (self .model_info )
387
358
return model , weights
388
359
389
360
def auto_model_search (self , network_info ):
@@ -547,37 +518,8 @@ def fit_to_input(self, data, layer_name, layout, precision, template=None):
547
518
data = data .astype (precision )
548
519
return data
549
520
550
- def prepare_model (self , launcher ):
551
- launcher_specific_entries = [
552
- 'model' , 'weights' , 'caffe_model' , 'caffe_weights' , 'tf_model' , 'inputs' , 'outputs' , '_model_optimizer'
553
- ]
554
-
555
- def update_mo_params (launcher_config , model_config ):
556
- for entry in launcher_specific_entries :
557
- if entry not in launcher_config :
558
- continue
559
- if entry in model_config :
560
- continue
561
- model_config [entry ] = launcher_config [entry ]
562
- model_mo_flags , model_mo_params = model_config .get ('mo_flags' , []), model_config .get ('mo_params' , {})
563
- launcher_mo_flags , launcher_mo_params = launcher_config .get ('mo_flags' , []), launcher_config .get (
564
- 'mo_params' , {})
565
- for launcher_flag in launcher_mo_flags :
566
- if launcher_flag not in model_mo_flags :
567
- model_mo_flags .append (launcher_flag )
568
-
569
- for launcher_mo_key , launcher_mo_value in launcher_mo_params .items ():
570
- if launcher_mo_key not in model_mo_params :
571
- model_mo_params [launcher_mo_key ] = launcher_mo_value
572
-
573
- model_config ['mo_flags' ] = model_mo_flags
574
- model_config ['mo_params' ] = model_mo_params
575
-
576
- update_mo_params (launcher .config , self .model_info )
577
- if 'caffe_model' in self .model_info :
578
- model , weights = launcher .convert_model (self .model_info )
579
- else :
580
- model , weights = self .auto_model_search (self .model_info )
521
+ def prepare_model (self ):
522
+ model , weights = self .auto_model_search (self .model_info )
581
523
return model , weights
582
524
583
525
def auto_model_search (self , network_info ):
@@ -707,7 +649,7 @@ def __init__(
707
649
self .adapter = None
708
650
self .is_dynamic = False
709
651
if not delayed_model_loading :
710
- model_xml , model_bin = self .prepare_model (launcher )
652
+ model_xml , model_bin = self .prepare_model ()
711
653
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'pnet_' , log = True )
712
654
pnet_outs = model_info ['outputs' ]
713
655
pnet_adapter_config = launcher .config .get ('adapter' , {'type' : 'mtcnn_p' , ** pnet_outs })
@@ -758,7 +700,7 @@ def __init__(
758
700
self .adapter = None
759
701
self .is_dynamic = False
760
702
if not delayed_model_loading :
761
- model_xml , model_bin = self .prepare_model (launcher )
703
+ model_xml , model_bin = self .prepare_model ()
762
704
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'pnet_' , log = True )
763
705
pnet_outs = model_info ['outputs' ]
764
706
pnet_adapter_config = launcher .config .get ('adapter' , {'type' : 'mtcnn_p' , ** pnet_outs })
@@ -810,7 +752,7 @@ def __init__(
810
752
self .is_dynamic = False
811
753
self .launcher = launcher
812
754
if not delayed_model_loading :
813
- model_xml , model_bin = self .prepare_model (launcher )
755
+ model_xml , model_bin = self .prepare_model ()
814
756
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'rnet_' , log = True )
815
757
816
758
def predict (self , input_blobs , batch_meta , output_callback = None ):
@@ -829,7 +771,7 @@ def __init__(
829
771
self .is_dynamic = False
830
772
self .launcher = launcher
831
773
if not delayed_model_loading :
832
- model_xml , model_bin = self .prepare_model (launcher )
774
+ model_xml , model_bin = self .prepare_model ()
833
775
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'rnet_' , log = True )
834
776
835
777
def predict (self , input_blobs , batch_meta , output_callback = None ):
@@ -848,7 +790,7 @@ def __init__(
848
790
self .is_dynamic = False
849
791
self .launcher = launcher
850
792
if not delayed_model_loading :
851
- model_xml , model_bin = self .prepare_model (launcher )
793
+ model_xml , model_bin = self .prepare_model ()
852
794
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'onet_' , log = True )
853
795
854
796
def predict (self , input_blobs , batch_meta , output_callback = None ):
@@ -865,7 +807,7 @@ def __init__(
865
807
self .is_dynamic = False
866
808
self .launcher = launcher
867
809
if not delayed_model_loading :
868
- model_xml , model_bin = self .prepare_model (launcher )
810
+ model_xml , model_bin = self .prepare_model ()
869
811
self .load_model ({'model' : model_xml , 'weights' : model_bin }, launcher , 'onet_' , log = True )
870
812
871
813
def predict (self , input_blobs , batch_meta , output_callback = None ):
0 commit comments