Error in train command in ZapWorks CLI

An error occurred when I tried to create a ZPT file with a 3.6MB JPEG image using the ZapWorks CLI.

zapworks train ■■■.jpg
Training the image - this may take a few moments…
throw new Error(maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB);
Error: maxMemoryUsageInMB limit exceeded by at least 133MB
at Function.requestMemoryAllocation (C:\Users\■■■\AppData\Roaming\npm\node_modules@zappar\zapworks-cli\node_modules\jpeg-js\lib\decoder.js:1051:13)
at Object.decode [as image/jpeg] (C:\Users\■■■\AppData\Roaming\npm\node_modules@zappar\zapworks-cli\node_modules\jpeg-js\lib\decoder.js:1101:15)
at Jimp.parseBitmap (C:\Users\■■■\AppData\Roaming\npm\node_modules@zappar\zapworks-cli\node_modules@jimp\core\dist\utils\image-bitmap.js:196:53)
at Jimp.parseBitmap (C:\Users\■■■\AppData\Roaming\npm\node_modules@zappar\zapworks-cli\node_modules@jimp\core\dist\index.js:431:32)
at C:\Users\■■■\AppData\Roaming\npm\node_modules@zappar\zapworks-cli\node_modules@jimp\core\dist\index.js:373:15
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
methodName: ‘constructor’
ZapWorks Studio successfully created the ZPT file and the image tracking was also successful.

The execution environment is as follows.
Windows 10
NodeJS v16.14.0
@zappar/zapworks-cli 1.0.0

I’m thinking of ZapWorks Studio and zapworks CLI or Universal AR for accuracy in creating ZPT files and image tracking. Is there any difference? I am planning to develop Universal AR application in the future.

Until now, we have been creating them in ZapWorks Studio. As for the development, it is natural that there is a difference between Universal AR and ZapWorks Studio, but I believe that there is no difference in accuracy and quality, but if there are any areas where Universal AR is inferior, please share that information as well.


Hi @tokuyama,

Thanks so much for sending in a support ticket - I’ve sent a response, so hopefully you received it and we can solve this as soon as possible for you!

As for your other questions - we find that the training accuracy is similar, though ZapWorks Studio can sometimes train slightly better depending on the image - I’m not 100% sure what the edge case for this would be however. :thinking:

If you are developing an experience with the Universal AR SDK and find that your target isn’t as stable as you’d like using the ZapWorks CLI, make sure to follow our Best Practice guide and try again first, then consider trying ZapWorks Studio. You can then export your .ZPP from Studio’s Media Library and use it in your Universal AR SDK project.

Both ZapWorks Studio and the Universal AR SDKs are great for developing experiences with a rage of depth, and in fact, many of the things you can do with Universal AR, you can do in ZapWorks Studio. Where Universal AR shines however is when you need that extra control or functionality that Studio may not provide.

For example, let’s say you wanted to create an experience that has a 3D Model and a shadow. In Studio, you would need to either include the shadow in the 3D Model file, or include an image of a shadow in the Media Library. If you then needed the shadow to move, you would either need to have this animated in your model’s file, or use a Timeline to transform your image file. Conversely, with the Universal AR SDK, you can use your library of choice to set a shadow depending on the type of light you are using, and can therefore have real-time shadow effects.

For more information, I’d consider watching the 'How to choose which AR tools work best for you’ webinar, in which we live-demo ZapWorks Studio and the Universal AR SDK.

Have a great day!
Francesca :blush:

Hi @Francesca
Please let me know the cause of the Train error and the solution to be able to generate zpt files without error.

1 Like

Hi @tokuyama,

I believe I have answered your support ticket, but I did want to add on to this thread in case it was helpful for anybody :slightly_smiling_face:

For best results, your image should be using a standardized resolution, for example 1024x512 px. A destandardized or odd value in either the width or the height can cause issues when training up the image.

Sometimes, reducing images by just half of their original size can help. In the case where your target has a 4k dimensional image for example, it’s not really necessary to train that up when the size of the image will look different (usually smaller) on a user’s device.

Ultimately, you can experiment and see if this changes depending on the image!

Have a great day,
Francesca :blush:

1 Like