'Allocating a path to a numpy array
I have an image as an np array and I want to pass it to a model which just accepts the image path as the input. What is the best and most optimized way of getting a path for my image?
Writing on the disk doesn't seem reasonable for a large number of images. Is there a way to get a path on the memory?
Solution 1:[1]
Create a tmpfs filesystem (aka a RAM disk), save the NumPy array as a file there. This way it won't do any actual disk I/O.
Of course, with modern SSDs I doubt you'll measure any speedup in your overall system.
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 | John Zwinck |
