Released Neural Network Libraries v1.8.0!

Friday, June 05, 2020

Release

Posted by shin

We have released Neural Network Libraries v1.8.0! We have added a powerful debugging tool called NanInfTracer, new evaluation metrics (LPIPS, Inception Score, FID), and new easy-to-follow tutorials for beginners that run directly on Colab!

Spotlight

NanInfTracer

We have added NanInferTracer that tracks where in the network is responsible for Nan or Inf. It can be used simply by adding a few lines as below:

pred = model(...)

from nnabla.utils.inspection import NanInfTracer
nit = NanInfTracer(trace_inf=True, trace_nan=True, need_details=True)

with nit.trace():
    ...
    pred.forward(function_post_hook=nit.forward_post_hook)
    pred.backward(function_post_hook=nit.backward_post_hook)
    ...

When Nan or Inf occur, the following message is printed.

Error during forward propagation
        Convolution
        Convolution
        Constant
        Reshape
        Div2 <-- ERROR

ValueError: The 0th output of the function 'Div2' (rank: 3) has nan or inf as its values.
        Function details:
            function type: Div2
            shapes of inputs: ['(2, 4, 10, 10)', '(1, 1, 1, 1)']
            shapes of outputs: ['(2, 4, 10, 10)']
            function args: {}

With NanInfTracer, debugging which layer leads to unanticipated computation is easier than ever!

Inception Score / FID and LPIPS

Inception Score and FID, popular evaluation metrics for generative models such as GAN, are now available in NNabla! You can execute it with command line interface (it is necessary to add the path nnabla-examples/utils/neu). These metrics are computed based on the features extracted from neural networks, and we are using the same neural network architecture (InceptionV3) and the parameters that the original authors used.

# calculate Inception Score
python -m metrics.gan_eval.inception_score <path to the directory or text file> 

# calculate FID
python -m metrics.gan_eval.fid <path to the directory, text file, or .npz file of REAL data> \
                               <path to the directory, text file, or .npz file of FAKE data> \
                               --params-path <path to the pretrained weights, can be omitted>

We have also added LPIPS that measures perceptual similarity between images using features from DNN, which can be used in the same way as above. Please refer to documentation for each for further details.

NNabla Tutorials on Colab

Tutorials can now be run directly on colab by clicking “open in colab” badge!
On top of our previous tutorials that show you the basic usage of NNabla, we have also added tutorials on CIFAR-10 image classification and image generation with DCGAN. Strongly recommended for NNabla beginners!

MobileNet V1, V2, V3 for ImageNet example

ImageNetのExampleでMobileNetV1, V2, V3 are now available to use for ImageNet example! You can also download each model’s pre-trained weights.

Layers

Utilities

Build

Format Converter / Compatibility

Bugfix

Documentation

Example