Issue
I have zip file containing 4 image folders. The tutorial I followed on Google Colab uses a similar zip file but the file is hosted online and the link is given as the value of origin
parameter which is necessary.I uploaded my zip file to Google Drive and can access it in Colab. Is it possible to load a local file using get_file()?
Solution
I recently ran into this myself. After not finding answers, I had to put on the old thinking cap, and solved it.
So in the documentation for tf.keras.utils.get_file()
it states the first two arguments are mandatory, the rest can default per internals. These are the FILENAME for reference and naming in the cache, and ORIGIN which must be a URL from where the image/data is obtained.
myFile = sys.args[1] # just for example...
fullPath = os.path.abspath("./" + myFile) # or similar, depending on your scenario
data_for_processing = keras.utils.get_file(myFile, 'file://'+fullPath)
file://
is a URL for a local file trick.
Answered By - fotonix
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.