This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 2020import tensorflow as tf
2121from lucid .misc .io .reading import read
2222
23+ def load_text_labels (labels_path ):
24+ return read (labels_path , encoding = 'utf-8' ).splitlines ()
2325
2426def load_graphdef (model_url , reset_device = True ):
2527 """Load GraphDef from a binary proto file."""
Original file line number Diff line number Diff line change 1616from __future__ import absolute_import , division , print_function
1717
1818import tensorflow as tf
19- from lucid .modelzoo .util import load_graphdef , forget_xy
19+ from lucid .modelzoo .util import load_text_labels , load_graphdef , forget_xy
2020
2121class Model (object ):
2222 """Base pretrained model importer."""
2323
2424 model_path = None
25+ labels_path = None
26+ labels = None
2527 image_value_range = (- 1 , 1 )
2628 image_shape = [None , None , 3 ]
2729
2830 def __init__ (self ):
2931 self .graph_def = None
32+ if self .labels_path is not None :
33+ self .labels = load_text_labels (self .labels_path )
3034
3135 def load_graphdef (self ):
3236 self .graph_def = load_graphdef (self .model_path )
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def populate_inception_bottlenecks(scope):
3636
3737class InceptionV1 (Model ):
3838 model_path = 'gs://modelzoo/InceptionV1.pb'
39+ labels_path = 'gs://modelzoo/InceptionV1-labels.txt'
3940 image_shape = [224 , 224 , 3 ]
4041 image_value_range = (- 117 , 255 - 117 )
4142 input_name = 'input:0'
You can’t perform that action at this time.
0 commit comments