MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / modelFiles

Function modelFiles

tensorflow/go/example_inception_inference_test.go:221–243  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

219}
220
221func modelFiles(dir string) (modelfile, labelsfile string, err error) {
222 const URL = "https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip"
223 var (
224 model = filepath.Join(dir, "tensorflow_inception_graph.pb")
225 labels = filepath.Join(dir, "imagenet_comp_graph_label_strings.txt")
226 zipfile = filepath.Join(dir, "inception5h.zip")
227 )
228 if filesExist(model, labels) == nil {
229 return model, labels, nil
230 }
231 log.Println("Did not find model in", dir, "downloading from", URL)
232 if err := os.MkdirAll(dir, 0755); err != nil {
233 return "", "", err
234 }
235 if err := download(URL, zipfile); err != nil {
236 return "", "", fmt.Errorf("failed to download %v - %v", URL, err)
237 }
238 if err := unzip(dir, zipfile); err != nil {
239 return "", "", fmt.Errorf("failed to extract contents from model archive: %v", err)
240 }
241 os.Remove(zipfile)
242 return model, labels, filesExist(model, labels)
243}
244
245func filesExist(files ...string) error {
246 for _, f := range files {

Callers 1

ExampleFunction · 0.85

Calls 5

filesExistFunction · 0.85
unzipFunction · 0.85
downloadFunction · 0.70
JoinMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected