'How to read and load tarfile to extract feature vector

I'm trying to use inception_v3 feature vectors for image classification. I have downloaded the tar file from tfhub which is a tar.gz file. The link to the feature vectors is "https://tfhub.dev/google/imagenet/inception_v3/feature_vector/5". This will give me the model without the classification layer. I have downloaded the tar file and extracted it using tarfile library. But i'm not sure how to load/read the extracted file for using the feature vectors for classification.



Solution 1:[1]

You can use the tarfile module to extract tar.gz files and load the model with tf.keras.models.load_model

import tarfile
  
# open file
file = tarfile.open('imagenet_inception_v3_feature_vector_5.tar.gz')
  
# extracting file
file.extractall('/content/Destination_FolderName')
  
file.close()

#loading the saved file
tf.keras.models.load_model("/content/Destination_FolderName")

Solution 2:[2]

I already replied to your previous question: Constraints of type MathOptInterface.VariableIndex-in-MathOptInterface.ZeroOne are not supported by the solver. When using Ipopt solver in Julia

The JuMP community forum is a more appropriate place for general discussion. SO is more for specific questions.

https://discourse.julialang.org/c/domain/opt/13

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tfer3
Solution 2 Oscar Dowson