-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In ImageNetApp, leave JPEGs compressed so the full dataset fits in memory more easily #71
Comments
Decompressing the JPEGs may be slow (we should benchmark this). We can potentially get around this by beginning to decompress the next minibatch of JPEGs while we are calling ForwardBackward on the current minibatch of JPEGs. If decompressing and ForwardBackward take around the same time, this buys us a 2x speedup at the cost of making the code a more complex. Another possibility is to change the degree to which we compress the JPEGs so that decompressing is faster. |
The main change will be to modify |
Hello Robert, I wanted to confirm my understanding of the App and ask two questions about the proposed solution. I really appreciate your support until now, and want to thank you for your prompt responses.
2.Training Questions:
2.The total size of all the unprocessed training images is 138 GB. I was using a 5 worker g2.8xlarge cluster where each worker has a memory of 60 GB. Out of that 30 GB can be easily allocated to Spark and so a total of 150 GB can be made available to the RDDs. Given this, I feel that since the unprocessed size is 138 GB, and resizing reduces its size further, the RDDs should not have spilled to disk. Do you feel there might be a problem in some other area of the system/App. To recall, the App execution was happening smoothly over 1/10th of the data but failed when using entire data as per #63. Thanks, |
That looks mostly correct. The "decompression" that I'm referring to is not "tarred -> untarred" but rather "JPEG -> Array[Byte]", where the values in the Array[Byte] are the pixel values in the image.*** That decompression step increases the size of the data a bunch I think. Concretely, this decompression step happens in val decompressedResizedImage = ScaleAndConvert.decompressImageAndResize(content, height, width) Looking at val resizedImage = Thumbnails.of(im).forceSize(width, height).asBufferedImage() Some points:
*** Since the images are RGB 256x256, each image is 3x256x256 bytes, which is almost 200KB, therefore the full dataset (200KB x 1.2 million images) is about 235GB. Seems like this should still fit in memory... did I do that calculation correctly? |
Thank you for the detailed and thorough explanation. |
You're absolutely right that in principle, spilling to disk shouldn't be a problem at all. After all, Caffe reads data from disk. Deep learning is computationally expensive enough that there is enough time to prefetch the next minibatch while you're computing on your current minibatch. And since deep learning cycles predictably through the data, you know exactly what data you need next. The same is true with decompression. We should be preemptively decompress the next minibatch while we are computing on the first minibatch. I tried something similar a while ago using scala's |
Thank you for again for your continued help and support. 1. After all, Caffe reads data from disk 2. but Spark was still too slow when reading RDDs from disk |
Thanks for clarifying! Yes, I was referring to standalone Caffe. |
Has anyone benchmarked decompressing JPEGs? With multiple fast video cards we might need to prepare several mini-batches at once while a single mini-batch is being forwarded through the network (on each card), can this become a bottleneck? I guess if each GPU has a dedicated CPU core servicing it, and multiple cores work in parallel, it shouldn't be much worse, is that the case? |
See discussion in #63.
The text was updated successfully, but these errors were encountered: