R-CNN example in JAVA

I translated the R-CNN example to java. But in this case the masks are always NULL.
//!! outMasks has size of 90x100 but “get” method returns NULL
objectMask.put(0,0,outMasks.get(i,classId));

    private static void postprocess(Mat frame, java.util.List<Mat> outs)
    {
    Mat outDetections = outs.get(0);
    Mat outMasks = outs.get(1);

    int numDetections = outDetections.size(0);
    int numClasses = outMasks.size(1);

    outDetections = outDetections.reshape(1, (int)(outDetections.total() / 7));
    for (int i = 0; i < numDetections; ++i)
    {
        float score = (float)outDetections.get(i, 2)[0];
        if (score > 0.2f)
        {
            int classId = (int)outDetections.get(i, 1)[0];

            int left = (int)outDetections.get(i, 3)[0];
            int top = (int)(frame.rows() * outDetections.get(i, 4)[0]);
            int right = (int)(frame.cols() * outDetections.get(i, 5)[0]);
            int bottom = (int)(frame.rows() * outDetections.get(i, 6)[0]);

            left = Math.max(0, Math.min(left, frame.cols() - 1));
            top = Math.max(0, Math.min(top, frame.rows() - 1));
            right = Math.max(0, Math.min(right, frame.cols() - 1));
            bottom = Math.max(0, Math.min(bottom, frame.rows() - 1));
            Rect box = new Rect(left, top, right - left + 1, bottom - top + 1);

            Mat objectMask=new Mat((int)outMasks.size().width, (int)outMasks.size().height,CV_32F);
            
            //!! outMasks has size of 90x100 but "get" method returns NULL
            objectMask.put(0,0,outMasks.get(i,classId));

            drawBox(frame, classId, score, box, objectMask);

        }
    }
}