Deeplearning4j-core .jar file size


i worked on an image classifier (CNN) the last weeks and packaged it to an executable .jar file the very first time today. While doing so (using “mvn package”) i realized that my .jar file has an enormous size of 1.3GB. After playing around with the pom.xml i found out, that after packaging, the deeplearning4j-core dependency needs over 800MB.

So my questions:

  • Is there a possibility to reduce the size of the .jar file? (without dl4j .jar file only needs 60MB)
  • is there a workaround, to use the pre-trained network (which i saved as .zip file) without dl4j dependencies, so i can use it in my application to make predictions?

maybe for a little bit more context:

  • i am trying to classify incoming images with my pre-trained network. so the only file which i would need in that application is the saved network (.zip file). however to load this file i think i need deeplearning4j-core?!

Thanks :slight_smile:

@jakob_404 mind posting your exact pom? Some aspects can be explained here:



These are the two dependencies related to dl4j. I already removed “nd4j-native-platform” and am now using “nd4j-native” which already saves 400MB. Thanks for the link, hopefully i find something useful to save even more space.