コード例 #1
0
        public Tensor call(IEnumerable <IGraphNodeBase> trainableOutputs)
        {
            var output = trainableOutputs.ToArray();
            var loss   = YOLO.Loss.Zero;

            for (int scaleIndex = 0; scaleIndex < this.strides.Length; scaleIndex++)
            {
                IGraphNodeBase conv = output[scaleIndex * 2];
                IGraphNodeBase pred = output[scaleIndex * 2 + 1];

                loss += YOLO.ComputeLoss((Tensor)pred, (Tensor)conv,
                                         targetLabels: this.trueLabels[scaleIndex],
                                         targetBBoxes: this.trueBoxes[scaleIndex],
                                         strideSize: this.strides[scaleIndex],
                                         classCount: this.classCount,
                                         intersectionOverUnionLossThreshold: YOLO.DefaultIntersectionOverUnionLossThreshold);
            }

            this.add_loss(loss.Conf);
            this.add_loss(loss.GIUO);
            this.add_loss(loss.Prob);
            return(loss.Conf + loss.GIUO + loss.Prob);
        }