Пример #1
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Net))
            {
                LogError("owner is not initialized. Add Action \"newNet\".");
                return;
            }
            OpenCVForUnity.DnnModule.Net wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Net, OpenCVForUnity.DnnModule.Net>(owner);

            if (!(netInputShape.Value is OpenCVForUnityPlayMakerActions.MatOfInt))
            {
                LogError("netInputShape is not initialized. Add Action \"newMatOfInt\".");
                return;
            }
            OpenCVForUnity.CoreModule.MatOfInt wrapped_netInputShape = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.MatOfInt, OpenCVForUnity.CoreModule.MatOfInt>(netInputShape);

            if (!(weights.Value is OpenCVForUnityPlayMakerActions.LongArray))
            {
                LogError("weights is not initialized. Add Action \"newLongArray\".");
                return;
            }
            System.Int64[] wrapped_weights = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.LongArray, System.Int64[]>(weights);

            if (!(blobs.Value is OpenCVForUnityPlayMakerActions.LongArray))
            {
                LogError("blobs is not initialized. Add Action \"newLongArray\".");
                return;
            }
            System.Int64[] wrapped_blobs = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.LongArray, System.Int64[]>(blobs);

            wrapped_owner.getMemoryConsumption(layerId.Value, wrapped_netInputShape, wrapped_weights, wrapped_blobs);
        }
Пример #2
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Net))
            {
                LogError("owner is not initialized. Add Action \"newNet\".");
                return;
            }
            OpenCVForUnity.DnnModule.Net wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Net, OpenCVForUnity.DnnModule.Net>(owner);

            if (!(netInputShape.Value is OpenCVForUnityPlayMakerActions.MatOfInt))
            {
                LogError("netInputShape is not initialized. Add Action \"newMatOfInt\".");
                return;
            }
            OpenCVForUnity.CoreModule.MatOfInt wrapped_netInputShape = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.MatOfInt, OpenCVForUnity.CoreModule.MatOfInt>(netInputShape);

            int[]  int_weights    = weights.intValues;
            long[] casted_weights = new long[int_weights.Length];
            int_weights.CopyTo(casted_weights, 0);

            int[]  int_blobs    = blobs.intValues;
            long[] casted_blobs = new long[int_blobs.Length];
            int_blobs.CopyTo(casted_blobs, 0);

            wrapped_owner.getMemoryConsumption(layerId.Value, wrapped_netInputShape, casted_weights, casted_blobs);

            for (int i = 0; i < casted_weights.Length; i++)
            {
                weights.Set(i, (int)casted_weights[i]);
            }
            weights.SaveChanges();

            for (int i = 0; i < casted_blobs.Length; i++)
            {
                blobs.Set(i, (int)casted_blobs[i]);
            }
            blobs.SaveChanges();
        }