Пример #1
0
        public static HDlClassifier Deserialize(Stream stream)
        {
            HDlClassifier hdlClassifier = new HDlClassifier();

            hdlClassifier.DeserializeDlClassifier(HSerializedItem.Deserialize(stream));
            return(hdlClassifier);
        }
Пример #2
0
        public HDlClassifier Clone()
        {
            HSerializedItem serializedItemHandle = this.SerializeDlClassifier();
            HDlClassifier   hdlClassifier        = new HDlClassifier();

            hdlClassifier.DeserializeDlClassifier(serializedItemHandle);
            serializedItemHandle.Dispose();
            return(hdlClassifier);
        }
Пример #3
0
        internal static int LoadNew(IntPtr proc, int parIndex, int err, out HDlClassifier[] obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HDlClassifier[tuple.Length];
            for (int index = 0; index < tuple.Length; ++index)
            {
                obj[index] = new HDlClassifier(tuple[index].IP);
            }
            return(err);
        }
Пример #4
0
        /// <summary>
        ///   Infer the class affiliations for a set of images using the  deep-learning-based classifier.
        ///   Modified instance represents: Handle of the deep learning classification  results.
        /// </summary>
        /// <param name="images">Tuple of input images.</param>
        /// <param name="DLClassifierHandle">Handle of the deep-learning-based classifier.</param>
        public HDlClassifierResult(HImage images, HDlClassifier DLClassifierHandle)
        {
            IntPtr proc = HalconAPI.PreCall(2102);

            HalconAPI.Store(proc, 1, (HObjectBase)images);
            HalconAPI.Store(proc, 0, (HTool)DLClassifierHandle);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)images);
            GC.KeepAlive((object)DLClassifierHandle);
        }
Пример #5
0
        /// <summary>
        ///   Perform a training step of a deep-learning-based classifier on a batch of  images.
        ///   Modified instance represents: Handle of the training results from the  deep-learning-based classifier.
        /// </summary>
        /// <param name="batchImages">Images comprising the batch.</param>
        /// <param name="DLClassifierHandle">Handle of the deep-learning-based classifier.</param>
        /// <param name="batchLabels">Corresponding labels for each of the images. Default: []</param>
        public HDlClassifierTrainResult(
            HImage batchImages,
            HDlClassifier DLClassifierHandle,
            HTuple batchLabels)
        {
            IntPtr proc = HalconAPI.PreCall(2131);

            HalconAPI.Store(proc, 1, (HObjectBase)batchImages);
            HalconAPI.Store(proc, 0, (HTool)DLClassifierHandle);
            HalconAPI.Store(proc, 1, batchLabels);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(batchLabels);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)batchImages);
            GC.KeepAlive((object)DLClassifierHandle);
        }
Пример #6
0
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HDlClassifier obj)
 {
     obj = new HDlClassifier(HTool.UNDEF);
     return(obj.Load(proc, parIndex, err));
 }