vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,208 @@
|
||||
# This script is used to estimate an accuracy of different face detection models.
|
||||
# COCO evaluation tool is used to compute an accuracy metrics (Average Precision).
|
||||
# Script works with different face detection datasets.
|
||||
import os
|
||||
import json
|
||||
from fnmatch import fnmatch
|
||||
from math import pi
|
||||
import cv2 as cv
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pycocotools.coco import COCO
|
||||
from pycocotools.cocoeval import COCOeval
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Evaluate OpenCV face detection algorithms '
|
||||
'using COCO evaluation tool, http://cocodataset.org/#detections-eval')
|
||||
parser.add_argument('--proto', help='Path to .pbtxt of TensorFlow graph')
|
||||
parser.add_argument('--model', help='Path to .onnx of ONNX model or .pb from TensorFlow')
|
||||
parser.add_argument('--cascade', help='Optional path to trained Haar cascade as '
|
||||
'an additional model for evaluation')
|
||||
parser.add_argument('--ann', help='Path to text file with ground truth annotations')
|
||||
parser.add_argument('--pics', help='Path to images root directory')
|
||||
parser.add_argument('--fddb', help='Evaluate FDDB dataset, http://vis-www.cs.umass.edu/fddb/', action='store_true')
|
||||
parser.add_argument('--wider', help='Evaluate WIDER FACE dataset, http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
dataset = {}
|
||||
dataset['images'] = []
|
||||
dataset['categories'] = [{ 'id': 0, 'name': 'face' }]
|
||||
dataset['annotations'] = []
|
||||
|
||||
def ellipse2Rect(params):
|
||||
rad_x = params[0]
|
||||
rad_y = params[1]
|
||||
angle = params[2] * 180.0 / pi
|
||||
center_x = params[3]
|
||||
center_y = params[4]
|
||||
pts = cv.ellipse2Poly((int(center_x), int(center_y)), (int(rad_x), int(rad_y)),
|
||||
int(angle), 0, 360, 10)
|
||||
rect = cv.boundingRect(pts)
|
||||
left = rect[0]
|
||||
top = rect[1]
|
||||
right = rect[0] + rect[2]
|
||||
bottom = rect[1] + rect[3]
|
||||
return left, top, right, bottom
|
||||
|
||||
def addImage(imagePath):
|
||||
assert('images' in dataset)
|
||||
imageId = len(dataset['images'])
|
||||
dataset['images'].append({
|
||||
'id': int(imageId),
|
||||
'file_name': imagePath
|
||||
})
|
||||
return imageId
|
||||
|
||||
def addBBox(imageId, left, top, width, height):
|
||||
assert('annotations' in dataset)
|
||||
dataset['annotations'].append({
|
||||
'id': len(dataset['annotations']),
|
||||
'image_id': int(imageId),
|
||||
'category_id': 0, # Face
|
||||
'bbox': [int(left), int(top), int(width), int(height)],
|
||||
'iscrowd': 0,
|
||||
'area': float(width * height)
|
||||
})
|
||||
|
||||
def addDetection(detections, imageId, left, top, width, height, score):
|
||||
detections.append({
|
||||
'image_id': int(imageId),
|
||||
'category_id': 0, # Face
|
||||
'bbox': [int(left), int(top), int(width), int(height)],
|
||||
'score': float(score)
|
||||
})
|
||||
|
||||
|
||||
def fddb_dataset(annotations, images):
|
||||
for d in os.listdir(annotations):
|
||||
if fnmatch(d, 'FDDB-fold-*-ellipseList.txt'):
|
||||
with open(os.path.join(annotations, d), 'rt') as f:
|
||||
lines = [line.rstrip('\n') for line in f]
|
||||
lineId = 0
|
||||
while lineId < len(lines):
|
||||
# Image
|
||||
imgPath = lines[lineId]
|
||||
lineId += 1
|
||||
imageId = addImage(os.path.join(images, imgPath) + '.jpg')
|
||||
|
||||
img = cv.imread(os.path.join(images, imgPath) + '.jpg')
|
||||
|
||||
# Faces
|
||||
numFaces = int(lines[lineId])
|
||||
lineId += 1
|
||||
for i in range(numFaces):
|
||||
params = [float(v) for v in lines[lineId].split()]
|
||||
lineId += 1
|
||||
left, top, right, bottom = ellipse2Rect(params)
|
||||
addBBox(imageId, left, top, width=right - left + 1,
|
||||
height=bottom - top + 1)
|
||||
|
||||
|
||||
def wider_dataset(annotations, images):
|
||||
with open(annotations, 'rt') as f:
|
||||
lines = [line.rstrip('\n') for line in f]
|
||||
lineId = 0
|
||||
while lineId < len(lines):
|
||||
# Image
|
||||
imgPath = lines[lineId]
|
||||
lineId += 1
|
||||
imageId = addImage(os.path.join(images, imgPath))
|
||||
|
||||
# Faces
|
||||
numFaces = int(lines[lineId])
|
||||
lineId += 1
|
||||
for i in range(numFaces):
|
||||
params = [int(v) for v in lines[lineId].split()]
|
||||
lineId += 1
|
||||
left, top, width, height = params[0], params[1], params[2], params[3]
|
||||
addBBox(imageId, left, top, width, height)
|
||||
|
||||
def evaluate():
|
||||
cocoGt = COCO('annotations.json')
|
||||
cocoDt = cocoGt.loadRes('detections.json')
|
||||
cocoEval = COCOeval(cocoGt, cocoDt, 'bbox')
|
||||
cocoEval.evaluate()
|
||||
cocoEval.accumulate()
|
||||
cocoEval.summarize()
|
||||
|
||||
|
||||
### Convert to COCO annotations format #########################################
|
||||
assert(args.fddb or args.wider)
|
||||
if args.fddb:
|
||||
fddb_dataset(args.ann, args.pics)
|
||||
elif args.wider:
|
||||
wider_dataset(args.ann, args.pics)
|
||||
|
||||
with open('annotations.json', 'wt') as f:
|
||||
json.dump(dataset, f)
|
||||
|
||||
### Obtain detections ##########################################################
|
||||
detections = []
|
||||
if args.proto and args.model and args.model.endswith('.pb'):
|
||||
net = cv.dnn.readNet(args.proto, args.model)
|
||||
|
||||
def detect(img, imageId):
|
||||
imgWidth = img.shape[1]
|
||||
imgHeight = img.shape[0]
|
||||
net.setInput(cv.dnn.blobFromImage(img, 1.0, (300, 300), (104., 177., 123.), False, False))
|
||||
out = net.forward()
|
||||
|
||||
for i in range(out.shape[2]):
|
||||
confidence = out[0, 0, i, 2]
|
||||
left = int(out[0, 0, i, 3] * img.shape[1])
|
||||
top = int(out[0, 0, i, 4] * img.shape[0])
|
||||
right = int(out[0, 0, i, 5] * img.shape[1])
|
||||
bottom = int(out[0, 0, i, 6] * img.shape[0])
|
||||
|
||||
x = max(0, min(left, img.shape[1] - 1))
|
||||
y = max(0, min(top, img.shape[0] - 1))
|
||||
w = max(0, min(right - x + 1, img.shape[1] - x))
|
||||
h = max(0, min(bottom - y + 1, img.shape[0] - y))
|
||||
|
||||
addDetection(detections, imageId, x, y, w, h, score=confidence)
|
||||
|
||||
elif args.model and args.model.endswith('.onnx'):
|
||||
net = cv.FaceDetectorYN.create(args.model, "", (320, 320), 0.3, 0.45, 5000)
|
||||
|
||||
def detect(img, imageId):
|
||||
net.setInputSize((img.shape[1], img.shape[0]))
|
||||
faces = net.detect(img)
|
||||
|
||||
if faces[1] is not None:
|
||||
for idx, face in enumerate(faces[1]):
|
||||
left, top, width, height = face[0], face[1], face[2], face[3]
|
||||
addDetection(detections, imageId, left, top, width, height, score=face[-1])
|
||||
|
||||
elif args.cascade:
|
||||
cascade = cv.CascadeClassifier(args.cascade)
|
||||
|
||||
def detect(img, imageId):
|
||||
srcImgGray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
|
||||
faces = cascade.detectMultiScale(srcImgGray)
|
||||
|
||||
for rect in faces:
|
||||
left, top, width, height = rect[0], rect[1], rect[2], rect[3]
|
||||
addDetection(detections, imageId, left, top, width, height, score=1.0)
|
||||
|
||||
for i in range(len(dataset['images'])):
|
||||
sys.stdout.write('\r%d / %d' % (i + 1, len(dataset['images'])))
|
||||
sys.stdout.flush()
|
||||
|
||||
img = cv.imread(dataset['images'][i]['file_name'])
|
||||
imageId = int(dataset['images'][i]['id'])
|
||||
|
||||
detect(img, imageId)
|
||||
|
||||
with open('detections.json', 'wt') as f:
|
||||
json.dump(detections, f)
|
||||
|
||||
evaluate()
|
||||
|
||||
|
||||
def rm(f):
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
rm('annotations.json')
|
||||
rm('detections.json')
|
||||
@@ -0,0 +1 @@
|
||||
misc/java/src/cpp/dnn_converters.hpp
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"type_dict": {
|
||||
"MatShape": {
|
||||
"j_type": "MatOfInt",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "MatShape %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfInt"
|
||||
},
|
||||
"vector_MatShape": {
|
||||
"j_type": "List<MatOfInt>",
|
||||
"jn_type": "List<MatOfInt>",
|
||||
"jni_type": "jobject",
|
||||
"jni_var": "std::vector< MatShape > %(n)s",
|
||||
"suffix": "Ljava_util_List",
|
||||
"v_type": "vector_MatShape",
|
||||
"j_import": "org.opencv.core.MatOfInt"
|
||||
},
|
||||
"vector_size_t": {
|
||||
"j_type": "MatOfDouble",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<size_t> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfDouble"
|
||||
},
|
||||
"vector_Ptr_Layer": {
|
||||
"j_type": "List<Layer>",
|
||||
"jn_type": "List<Layer>",
|
||||
"jni_type": "jobject",
|
||||
"jni_var": "std::vector< Ptr<cv::dnn::Layer> > %(n)s",
|
||||
"suffix": "Ljava_util_List",
|
||||
"v_type": "vector_Layer",
|
||||
"j_import": "org.opencv.dnn.Layer"
|
||||
},
|
||||
"vector_Target": {
|
||||
"j_type": "List<Integer>",
|
||||
"jn_type": "List<Integer>",
|
||||
"jni_type": "jobject",
|
||||
"jni_var": "std::vector< cv::dnn::Target > %(n)s",
|
||||
"suffix": "Ljava_util_List",
|
||||
"v_type": "vector_Target"
|
||||
},
|
||||
"LayerId": {
|
||||
"j_type": "DictValue",
|
||||
"jn_type": "long",
|
||||
"jn_args": [
|
||||
[
|
||||
"__int64",
|
||||
".getNativeObjAddr()"
|
||||
]
|
||||
|
||||
],
|
||||
"jni_name": "(*(*(Ptr<cv::dnn::DictValue>*)%(n)s_nativeObj))",
|
||||
"jni_type": "jlong",
|
||||
"suffix": "J",
|
||||
"j_import": "org.opencv.dnn.DictValue"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
// Author: abratchik
|
||||
|
||||
#include "dnn_converters.hpp"
|
||||
|
||||
#define LOG_TAG "org.opencv.dnn"
|
||||
|
||||
void Mat_to_MatShape(cv::Mat& mat, cv::MatShape& matshape)
|
||||
{
|
||||
matshape.clear();
|
||||
CHECK_MAT(mat.type()==CV_32SC1 && mat.cols==1);
|
||||
matshape = (cv::MatShape) mat;
|
||||
}
|
||||
|
||||
void MatShape_to_Mat(cv::MatShape& matshape, cv::Mat& mat)
|
||||
{
|
||||
mat = cv::Mat(matshape, true);
|
||||
}
|
||||
|
||||
std::vector<cv::MatShape> List_to_vector_MatShape(JNIEnv* env, jobject list)
|
||||
{
|
||||
static jclass juArrayList = ARRAYLIST(env);
|
||||
jmethodID m_size = LIST_SIZE(env, juArrayList);
|
||||
jmethodID m_get = LIST_GET(env, juArrayList);
|
||||
|
||||
static jclass jMatOfInt = MATOFINT(env);
|
||||
|
||||
jint len = env->CallIntMethod(list, m_size);
|
||||
std::vector<cv::MatShape> result;
|
||||
result.reserve(len);
|
||||
for (jint i=0; i<len; i++)
|
||||
{
|
||||
jobject element = static_cast<jobject>(env->CallObjectMethod(list, m_get, i));
|
||||
cv::Mat& mat = *((cv::Mat*) GETNATIVEOBJ(env, jMatOfInt, element) );
|
||||
cv::MatShape matshape = (cv::MatShape) mat;
|
||||
result.push_back(matshape);
|
||||
env->DeleteLocalRef(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
jobject vector_Ptr_Layer_to_List(JNIEnv* env, std::vector<cv::Ptr<cv::dnn::Layer> >& vs)
|
||||
{
|
||||
static jclass juArrayList = ARRAYLIST(env);
|
||||
static jmethodID m_create = CONSTRUCTOR(env, juArrayList);
|
||||
jmethodID m_add = LIST_ADD(env, juArrayList);
|
||||
|
||||
static jclass jLayerClass = LAYER(env);
|
||||
static jmethodID m_create_layer = LAYER_CONSTRUCTOR(env, jLayerClass);
|
||||
|
||||
jobject result = env->NewObject(juArrayList, m_create, vs.size());
|
||||
for (std::vector< cv::Ptr<cv::dnn::Layer> >::iterator it = vs.begin(); it != vs.end(); ++it) {
|
||||
jobject element = env->NewObject(jLayerClass, m_create_layer, (*it).get());
|
||||
env->CallBooleanMethod(result, m_add, element);
|
||||
env->DeleteLocalRef(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
jobject vector_Target_to_List(JNIEnv* env, std::vector<cv::dnn::Target>& vs)
|
||||
{
|
||||
static jclass juArrayList = ARRAYLIST(env);
|
||||
static jmethodID m_create = CONSTRUCTOR(env, juArrayList);
|
||||
jmethodID m_add = LIST_ADD(env, juArrayList);
|
||||
|
||||
static jclass jInteger = env->FindClass("java/lang/Integer");
|
||||
static jmethodID m_create_Integer = env->GetMethodID(jInteger, "<init>", "(I)V");
|
||||
|
||||
jobject result = env->NewObject(juArrayList, m_create, vs.size());
|
||||
for (size_t i = 0; i < vs.size(); ++i)
|
||||
{
|
||||
jobject element = env->NewObject(jInteger, m_create_Integer, vs[i]);
|
||||
env->CallBooleanMethod(result, m_add, element);
|
||||
env->DeleteLocalRef(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<cv::Ptr<cv::dnn::Layer> > List_to_vector_Ptr_Layer(JNIEnv* env, jobject list)
|
||||
{
|
||||
static jclass juArrayList = ARRAYLIST(env);
|
||||
jmethodID m_size = LIST_SIZE(env, juArrayList);
|
||||
jmethodID m_get = LIST_GET(env, juArrayList);
|
||||
|
||||
static jclass jLayerClass = LAYER(env);
|
||||
|
||||
jint len = env->CallIntMethod(list, m_size);
|
||||
std::vector< cv::Ptr<cv::dnn::Layer> > result;
|
||||
result.reserve(len);
|
||||
for (jint i=0; i<len; i++)
|
||||
{
|
||||
jobject element = static_cast<jobject>(env->CallObjectMethod(list, m_get, i));
|
||||
cv::Ptr<cv::dnn::Layer>* layer_ptr = (cv::Ptr<cv::dnn::Layer>*) GETNATIVEOBJ(env, jLayerClass, element) ;
|
||||
cv::Ptr<cv::dnn::Layer> layer = *(layer_ptr);
|
||||
result.push_back(layer);
|
||||
env->DeleteLocalRef(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
// Author: abratchik
|
||||
|
||||
#ifndef DNN_CONVERTERS_HPP
|
||||
#define DNN_CONVERTERS_HPP
|
||||
|
||||
#include <jni.h>
|
||||
#include "opencv_java.hpp"
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/dnn/dnn.hpp"
|
||||
|
||||
#define LAYER(ENV) static_cast<jclass>(ENV->NewGlobalRef(ENV->FindClass("org/opencv/dnn/Layer")))
|
||||
#define LAYER_CONSTRUCTOR(ENV, CLS) ENV->GetMethodID(CLS, "<init>", "(J)V")
|
||||
|
||||
using namespace cv::dnn;
|
||||
|
||||
void Mat_to_MatShape(cv::Mat& mat, cv::MatShape& matshape);
|
||||
|
||||
void MatShape_to_Mat(cv::MatShape& matshape, cv::Mat& mat);
|
||||
|
||||
std::vector<cv::MatShape> List_to_vector_MatShape(JNIEnv* env, jobject list);
|
||||
|
||||
jobject vector_Ptr_Layer_to_List(JNIEnv* env, std::vector<cv::Ptr<cv::dnn::Layer> >& vs);
|
||||
|
||||
std::vector<cv::Ptr<cv::dnn::Layer> > List_to_vector_Ptr_Layer(JNIEnv* env, jobject list);
|
||||
|
||||
jobject vector_Target_to_List(JNIEnv* env, std::vector<cv::dnn::Target>& vs);
|
||||
|
||||
#endif /* DNN_CONVERTERS_HPP */
|
||||
@@ -0,0 +1,149 @@
|
||||
package org.opencv.test.dnn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.core.Range;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Image2BlobParams;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class DnnBlobFromImageWithParamsTest extends OpenCVTestCase {
|
||||
|
||||
// test for DATA_LAYOUT_* and DNN_LAYOUT_* access from Core
|
||||
public void testDataLayoutConstants()
|
||||
{
|
||||
assertEquals(0, Core.DATA_LAYOUT_UNKNOWN);
|
||||
assertEquals(1, Core.DATA_LAYOUT_ND);
|
||||
assertEquals(2, Core.DATA_LAYOUT_NCHW);
|
||||
assertEquals(3, Core.DATA_LAYOUT_NCDHW);
|
||||
assertEquals(4, Core.DATA_LAYOUT_NHWC);
|
||||
assertEquals(5, Core.DATA_LAYOUT_NDHWC);
|
||||
assertEquals(6, Core.DATA_LAYOUT_PLANAR);
|
||||
assertEquals(7, Core.DATA_LAYOUT_BLOCK);
|
||||
}
|
||||
|
||||
public void testBlobFromImageWithParamsNHWCScalarScale()
|
||||
{
|
||||
// https://github.com/opencv/opencv/issues/27264
|
||||
Mat img = new Mat(10, 10, CvType.CV_8UC4, new Scalar(0, 1, 2, 3));
|
||||
Scalar scalefactor = new Scalar(0.1, 0.2, 0.3, 0.4);
|
||||
|
||||
Image2BlobParams params = new Image2BlobParams();
|
||||
params.set_scalefactor(scalefactor);
|
||||
params.set_datalayout(Core.DATA_LAYOUT_NHWC);
|
||||
|
||||
Mat blob = Dnn.blobFromImageWithParams(img, params); // [1, 10, 10, 4]
|
||||
|
||||
float[] expectedValues = { (float)scalefactor.val[0] * 0, (float)scalefactor.val[1] * 1, (float)scalefactor.val[2] * 2, (float)scalefactor.val[3] * 3 }; // Target Value.
|
||||
for (int h = 0; h < 10; h++)
|
||||
{
|
||||
for (int w = 0; w < 10; w++)
|
||||
{
|
||||
float[] actualValues = new float[4];
|
||||
blob.get(new int[]{0, h, w, 0}, actualValues);
|
||||
for (int c = 0; c < 4; c++)
|
||||
{
|
||||
// Check equal
|
||||
assertEquals(expectedValues[c], actualValues[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testBlobFromImageWithParamsCustomPaddingLetterBox()
|
||||
{
|
||||
Mat img = new Mat(40, 20, CvType.CV_8UC4, new Scalar(0, 1, 2, 3));
|
||||
|
||||
// Custom padding value that you have added
|
||||
Scalar customPaddingValue = new Scalar(5, 6, 7, 8); // Example padding value
|
||||
Size targetSize = new Size(20, 20);
|
||||
|
||||
Mat targetImg = img.clone();
|
||||
Core.copyMakeBorder(targetImg, targetImg, 0, 0, (int)targetSize.width / 2, (int)targetSize.width / 2, Core.BORDER_CONSTANT, customPaddingValue);
|
||||
|
||||
// Set up Image2BlobParams with your new functionality
|
||||
Image2BlobParams params = new Image2BlobParams();
|
||||
params.set_size(targetSize);
|
||||
params.set_paddingmode(Dnn.DNN_PMODE_LETTERBOX);
|
||||
params.set_borderValue(customPaddingValue); // Use your new feature here
|
||||
|
||||
// Create blob with custom padding
|
||||
Mat blob = Dnn.blobFromImageWithParams(img, params);
|
||||
|
||||
// Create target blob for comparison
|
||||
Mat targetBlob = Dnn.blobFromImage(targetImg, 1.0, targetSize);
|
||||
|
||||
assertEquals(0, Core.norm(targetBlob, blob, Core.NORM_INF), EPS);
|
||||
}
|
||||
|
||||
public void testBlobFromImageWithParams4chLetterBox()
|
||||
{
|
||||
Mat img = new Mat(40, 20, CvType.CV_8UC4, new Scalar(0, 1, 2, 3));
|
||||
|
||||
// Construct target mat.
|
||||
Mat[] targetChannels = new Mat[4];
|
||||
|
||||
// The letterbox will add zero at the left and right of output blob.
|
||||
// After the letterbox, every row data would have same value showing as valVec.
|
||||
byte[] valVec = { 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1, 0,0,0,0,0};
|
||||
|
||||
Mat rowM = new Mat(1, 20, CvType.CV_8UC1);
|
||||
rowM.put(0, 0, valVec);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Core.multiply(rowM, new Scalar(i), targetChannels[i] = new Mat());
|
||||
}
|
||||
|
||||
Mat targetImg = new Mat();
|
||||
Core.merge(Arrays.asList(targetChannels), targetImg);
|
||||
Size targetSize = new Size(20, 20);
|
||||
|
||||
Image2BlobParams params = new Image2BlobParams();
|
||||
params.set_size(targetSize);
|
||||
params.set_paddingmode(Dnn.DNN_PMODE_LETTERBOX);
|
||||
Mat blob = Dnn.blobFromImageWithParams(img, params);
|
||||
Mat targetBlob = Dnn.blobFromImage(targetImg, 1.0, targetSize); // only convert data from uint8 to float32.
|
||||
|
||||
assertEquals(0, Core.norm(targetBlob, blob, Core.NORM_INF), EPS);
|
||||
}
|
||||
|
||||
// https://github.com/opencv/opencv/issues/27264
|
||||
public void testBlobFromImageWithParams4chMultiImage()
|
||||
{
|
||||
Mat img = new Mat(10, 10, CvType.CV_8UC4, new Scalar(0, 1, 2, 3));
|
||||
|
||||
Scalar scalefactor = new Scalar(0.1, 0.2, 0.3, 0.4);
|
||||
|
||||
Image2BlobParams param = new Image2BlobParams();
|
||||
param.set_scalefactor(scalefactor);
|
||||
param.set_datalayout(Core.DATA_LAYOUT_NHWC);
|
||||
|
||||
List<Mat> images = new ArrayList<>();
|
||||
images.add(img);
|
||||
Mat img2 = new Mat();
|
||||
Core.multiply(img, Scalar.all(2), img2);
|
||||
images.add(img2);
|
||||
|
||||
Mat blobs = Dnn.blobFromImagesWithParams(images, param);
|
||||
|
||||
Range[] ranges = new Range[4];
|
||||
ranges[0] = new Range(0, 1);
|
||||
ranges[1] = new Range(0, blobs.size(1));
|
||||
ranges[2] = new Range(0, blobs.size(2));
|
||||
ranges[3] = new Range(0, blobs.size(3));
|
||||
|
||||
Mat blob0 = blobs.submat(ranges).clone();
|
||||
|
||||
ranges[0] = new Range(1, 2);
|
||||
Mat blob1 = blobs.submat(ranges).clone();
|
||||
|
||||
Core.multiply(blob0, Scalar.all(2), blob0);
|
||||
|
||||
assertEquals(0, Core.norm(blob0, blob1, Core.NORM_INF), EPS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.opencv.test.dnn;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class DnnForwardAndRetrieve extends OpenCVTestCase {
|
||||
|
||||
private final static String ENV_OPENCV_DNN_TEST_DATA_PATH = "OPENCV_DNN_TEST_DATA_PATH";
|
||||
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
|
||||
|
||||
private String modelFileName = "";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
String dnnTestDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
|
||||
String generalTestDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
|
||||
|
||||
File model = null;
|
||||
|
||||
if (generalTestDataPath != null) {
|
||||
model = new File(generalTestDataPath, "dnn/onnx/models/split_0.onnx");
|
||||
}
|
||||
|
||||
if ((model == null || !model.isFile()) && dnnTestDataPath != null) {
|
||||
model = new File(dnnTestDataPath, "dnn/onnx/models/split_0.onnx");
|
||||
}
|
||||
|
||||
if (model == null || !model.isFile()) {
|
||||
isTestCaseEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
modelFileName = model.getAbsolutePath();
|
||||
}
|
||||
|
||||
public void testForwardAndRetrieve()
|
||||
{
|
||||
// Verifies forwardAndRetrieve nested list marshalling using a small ONNX model instead of the removed Caffe importer.
|
||||
Net net = Dnn.readNetFromONNX(modelFileName, Dnn.ENGINE_CLASSIC);
|
||||
net.setPreferableBackend(Dnn.DNN_BACKEND_OPENCV);
|
||||
|
||||
// split_0.onnx declares a single 4D input named "image" of shape [1, 3, 2, 2].
|
||||
Mat inp = new Mat(new int[]{1, 3, 2, 2}, CvType.CV_32F);
|
||||
Core.randu(inp, -1, 1);
|
||||
net.setInput(inp);
|
||||
|
||||
List<String> outNames = net.getUnconnectedOutLayersNames();
|
||||
assertFalse("Model has no output layers", outNames.isEmpty());
|
||||
|
||||
// Forward and retrieve every output blob of the requested layers.
|
||||
List<List<Mat>> outBlobs = new ArrayList<>();
|
||||
net.forwardAndRetrieve(outBlobs, outNames);
|
||||
|
||||
// One entry per requested layer name, each holding at least one valid blob.
|
||||
assertEquals(outNames.size(), outBlobs.size());
|
||||
for (List<Mat> blobs : outBlobs) {
|
||||
assertFalse(blobs.isEmpty());
|
||||
for (Mat blob : blobs)
|
||||
assertFalse(blob.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package org.opencv.test.dnn;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfInt;
|
||||
import org.opencv.core.MatOfFloat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.dnn.DictValue;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Layer;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
/*
|
||||
* regression test for #12324,
|
||||
* testing various java.util.List invocations,
|
||||
* which use the LIST_GET macro
|
||||
*/
|
||||
|
||||
public class DnnListRegressionTest extends OpenCVTestCase {
|
||||
|
||||
private final static String ENV_OPENCV_DNN_TEST_DATA_PATH = "OPENCV_DNN_TEST_DATA_PATH";
|
||||
|
||||
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
|
||||
|
||||
String modelFileName = "";
|
||||
String sourceImageFile = "";
|
||||
|
||||
Net net;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
String envDnnTestDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
|
||||
|
||||
if(envDnnTestDataPath == null){
|
||||
isTestCaseEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
File dnnTestDataPath = new File(envDnnTestDataPath);
|
||||
modelFileName = new File(dnnTestDataPath, "dnn/tensorflow_inception_graph.pb").toString();
|
||||
|
||||
String envTestDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
|
||||
|
||||
if(envTestDataPath == null) throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
|
||||
|
||||
File testDataPath = new File(envTestDataPath);
|
||||
|
||||
File f = new File(testDataPath, "dnn/grace_hopper_227.png");
|
||||
sourceImageFile = f.toString();
|
||||
if(!f.exists()) throw new Exception("Test image is missing: " + sourceImageFile);
|
||||
|
||||
net = Dnn.readNetFromTensorflow(modelFileName);
|
||||
|
||||
Mat image = Imgcodecs.imread(sourceImageFile);
|
||||
assertNotNull("Loading image from file failed!", image);
|
||||
|
||||
Mat inputBlob = Dnn.blobFromImage(image, 1.0, new Size(224, 224), new Scalar(0), true, true);
|
||||
assertNotNull("Converting image to blob failed!", inputBlob);
|
||||
|
||||
net.setInput(inputBlob, "");
|
||||
}
|
||||
|
||||
/*public void testSetInputsNames() {
|
||||
List<String> inputs = new ArrayList();
|
||||
inputs.add("input");
|
||||
try {
|
||||
net.setInputsNames(inputs);
|
||||
} catch(Exception e) {
|
||||
fail("Net setInputsNames failed: " + e.getMessage());
|
||||
}
|
||||
}*/
|
||||
|
||||
public void testForward() {
|
||||
Mat out;
|
||||
try {
|
||||
out = net.forward();
|
||||
} catch(Exception e) {
|
||||
fail("Net forward failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetMemoryConsumption() {
|
||||
List<MatOfInt> netInputShapes = new ArrayList();
|
||||
netInputShapes.add(new MatOfInt(1, 3, 224, 224));
|
||||
MatOfInt netInputTypes = new MatOfInt(5);
|
||||
long[] weights=null;
|
||||
long[] blobs=null;
|
||||
try {
|
||||
net.getMemoryConsumption(netInputShapes, netInputTypes, weights, blobs);
|
||||
} catch(Exception e) {
|
||||
fail("Net getMemoryConsumption failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetFLOPS() {
|
||||
List<MatOfInt> netInputShapes = new ArrayList();
|
||||
netInputShapes.add(new MatOfInt(1, 3, 224, 224));
|
||||
MatOfInt netInputTypes = new MatOfInt(5);
|
||||
try {
|
||||
net.getFLOPS(netInputShapes, netInputTypes);
|
||||
} catch(Exception e) {
|
||||
fail("Net getFLOPS failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package org.opencv.test.dnn;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfFloat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.dnn.DictValue;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Layer;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class DnnTensorFlowTest extends OpenCVTestCase {
|
||||
|
||||
private final static String ENV_OPENCV_DNN_TEST_DATA_PATH = "OPENCV_DNN_TEST_DATA_PATH";
|
||||
|
||||
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
|
||||
|
||||
String modelFileName = "";
|
||||
String sourceImageFile = "";
|
||||
|
||||
Net net;
|
||||
|
||||
private static void normAssert(Mat ref, Mat test) {
|
||||
final double l1 = 1e-5;
|
||||
final double lInf = 1e-4;
|
||||
double normL1 = Core.norm(ref, test, Core.NORM_L1) / ref.total();
|
||||
double normLInf = Core.norm(ref, test, Core.NORM_INF) / ref.total();
|
||||
assertTrue(normL1 < l1);
|
||||
assertTrue(normLInf < lInf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
String envDnnTestDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
|
||||
|
||||
if(envDnnTestDataPath == null){
|
||||
isTestCaseEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
File dnnTestDataPath = new File(envDnnTestDataPath);
|
||||
modelFileName = new File(dnnTestDataPath, "dnn/tensorflow_inception_graph.pb").toString();
|
||||
|
||||
String envTestDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
|
||||
|
||||
if(envTestDataPath == null) throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
|
||||
|
||||
File testDataPath = new File(envTestDataPath);
|
||||
|
||||
File f = new File(testDataPath, "dnn/grace_hopper_227.png");
|
||||
sourceImageFile = f.toString();
|
||||
if(!f.exists()) throw new Exception("Test image is missing: " + sourceImageFile);
|
||||
|
||||
net = Dnn.readNetFromTensorflow(modelFileName);
|
||||
}
|
||||
|
||||
public void testGetLayerTypes() {
|
||||
List<String> layertypes = new ArrayList();
|
||||
net.getLayerTypes(layertypes);
|
||||
|
||||
assertFalse("No layer types returned!", layertypes.isEmpty());
|
||||
}
|
||||
|
||||
public void testGetLayer() {
|
||||
List<String> layerNames = net.getLayerNames();
|
||||
assertFalse("Test net returned no layers!", layerNames.isEmpty());
|
||||
|
||||
int layerId = 0;
|
||||
for (String layerName: layerNames) {
|
||||
Layer layer = net.getLayer(layerId);
|
||||
assertEquals("Layer name does not match the expected value!", layerName, layer.get_name());
|
||||
layerId++;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkInceptionNet(Net net)
|
||||
{
|
||||
Mat image = Imgcodecs.imread(sourceImageFile);
|
||||
assertNotNull("Loading image from file failed!", image);
|
||||
|
||||
Mat inputBlob = Dnn.blobFromImage(image, 1.0, new Size(224, 224), new Scalar(0), true, true);
|
||||
assertNotNull("Converting image to blob failed!", inputBlob);
|
||||
|
||||
net.setInput(inputBlob, "");
|
||||
|
||||
Mat result = new Mat();
|
||||
try {
|
||||
net.setPreferableBackend(Dnn.DNN_BACKEND_OPENCV);
|
||||
result = net.forward("");
|
||||
}
|
||||
catch (Exception e) {
|
||||
fail("DNN forward failed: " + e.getMessage());
|
||||
}
|
||||
assertNotNull("Net returned no result!", result);
|
||||
|
||||
result = result.reshape(1, 1);
|
||||
Core.MinMaxLocResult minmax = Core.minMaxLoc(result);
|
||||
assertEquals("Wrong prediction", (int)minmax.maxLoc.x, 866);
|
||||
|
||||
Mat top5RefScores = new MatOfFloat(new float[] {
|
||||
0.63032645f, 0.2561979f, 0.032181446f, 0.015721032f, 0.014785315f
|
||||
}).reshape(1, 1);
|
||||
|
||||
Core.sort(result, result, Core.SORT_DESCENDING);
|
||||
|
||||
normAssert(result.colRange(0, 5), top5RefScores);
|
||||
}
|
||||
|
||||
public void testTestNetForward() {
|
||||
checkInceptionNet(net);
|
||||
}
|
||||
|
||||
public void testReadFromBuffer() {
|
||||
File modelFile = new File(modelFileName);
|
||||
byte[] modelBuffer = new byte[ (int)modelFile.length() ];
|
||||
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(modelFile);
|
||||
fis.read(modelBuffer);
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
fail("Failed to read a model: " + e.getMessage());
|
||||
}
|
||||
net = Dnn.readNetFromTensorflow(new MatOfByte(modelBuffer));
|
||||
checkInceptionNet(net);
|
||||
}
|
||||
|
||||
public void testGetAvailableTargets() {
|
||||
List<Integer> targets = Dnn.getAvailableTargets(Dnn.DNN_BACKEND_OPENCV);
|
||||
assertTrue(targets.contains(Dnn.DNN_TARGET_CPU));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"whitelist":
|
||||
{
|
||||
"dnn_Net": ["setInput", "forward", "setPreferableBackend","getUnconnectedOutLayersNames"],
|
||||
"": ["readNetFromTensorflow", "readNetFromTorch",
|
||||
"readNetFromONNX", "readNetFromTFLite", "readNet", "blobFromImage"]
|
||||
},
|
||||
"namespace_prefix_override":
|
||||
{
|
||||
"dnn": ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"func_arg_fix" : {
|
||||
"Dnn": {
|
||||
"(Net*)readNetFromONNX:(NSString*)onnxFile engine:(int)engine" : { "readNetFromONNX" : {"name" : "readNetFromONNXFile"} },
|
||||
"(Net*)readNetFromONNX:(ByteVector*)buffer engine:(int)engine" : { "readNetFromONNX" : {"name" : "readNetFromONNXBuffer"} },
|
||||
"(Net*)readNetFromTensorflow:(NSString*)model config:(NSString*)config engine:(int)engine extraOutputs:(NSArray<NSString*>*)extraOutputs" : { "readNetFromTensorflow" : {"name" : "readNetFromTensorflowFile"} },
|
||||
"(Net*)readNetFromTensorflow:(ByteVector*)bufferModel bufferConfig:(ByteVector*)bufferConfig engine:(int)engine extraOutputs:(NSArray<NSString*>*)extraOutputs" : { "readNetFromTensorflow" : {"name" : "readNetFromTensorflowBuffer"} },
|
||||
"(Net*)readNetFromTFLite:(NSString*)model engine:(int)engine" : { "readNetFromTFLite" : {"name" : "readNetFromTFLiteFile"} },
|
||||
"(Net*)readNetFromTFLite:(ByteVector*)buffer engine:(int)engine" : { "readNetFromTFLite" : {"name" : "readNetFromTFLiteBuffer"} }
|
||||
},
|
||||
"Net": {
|
||||
"(void)forward:(NSMutableArray<Mat*>*)outputBlobs outputName:(NSString*)outputName" : { "forward" : {"name" : "forwardOutputBlobs"} },
|
||||
"(void)forward:(NSMutableArray<Mat*>*)outputBlobs outBlobNames:(NSArray<NSString*>*)outBlobNames" : { "forward" : {"name" : "forwardOutputBlobs"} },
|
||||
"(void)forwardAndRetrieve:(NSMutableArray<NSMutableArray<Mat*>*>*)outputBlobs outBlobNames:(NSArray<NSString*>*)outBlobNames" : { "forward" : {"swift_name" : "forwardAndRetrieve"} },
|
||||
"(Layer*)getLayer:(NSString*)layerName" : { "getLayer" : {"name" : "getLayerByName"} },
|
||||
"(Layer*)getLayer:(DictValue*)layerId" : { "getLayer" : {"name" : "getLayerByDictValue"} },
|
||||
"(Mat*)getParam:(NSString*)layerName numParam:(int)numParam" : { "getParam" : {"name" : "getParamByName"} },
|
||||
"(void)setParam:(NSString*)layerName numParam:(int)numParam blob:(Mat*)blob" : { "setParam" : {"name" : "setParamByName"} }
|
||||
}
|
||||
},
|
||||
"type_dict": {
|
||||
"MatShape": {
|
||||
"objc_type": "IntVector*",
|
||||
"to_cpp": "cv::MatShape(%(n)s.nativeRef)",
|
||||
"from_cpp": "[IntVector fromNative:%(n)s.vec()]"
|
||||
},
|
||||
"vector_MatShape": {
|
||||
"objc_type": "IntVector*",
|
||||
"to_cpp": "cv::MatShape(%(n)s.nativeRef)",
|
||||
"from_cpp": "[IntVector fromNative:%(n)s.vec()]",
|
||||
"v_type": "MatShape"
|
||||
},
|
||||
"vector_vector_MatShape": {
|
||||
"objc_type": "IntVector*",
|
||||
"to_cpp": "cv::MatShape(%(n)s.nativeRef)",
|
||||
"from_cpp": "[IntVector fromNative:%(n)s.vec()]",
|
||||
"v_v_type": "MatShape"
|
||||
},
|
||||
"LayerId": {
|
||||
"objc_type": "DictValue*",
|
||||
"to_cpp": "*(cv::dnn::DictValue*)(%(n)s.nativePtr)",
|
||||
"from_cpp": "[DictValue fromNative:%(n)s]"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#include_directories("${OPENCV_MODULE_opencv_dnn_BINARY_DIR}") # Cannot open include file: 'layers/layers_common.simd_declarations.hpp'
|
||||
ocv_create_builtin_dnn_plugin(opencv_dnn_openvino ocv.3rdparty.openvino ${dnn_plugin_srcs})
|
||||
@@ -0,0 +1,214 @@
|
||||
#ifdef HAVE_OPENCV_DNN
|
||||
typedef dnn::DictValue LayerId;
|
||||
typedef std::vector<MatShape> vector_MatShape;
|
||||
typedef std::vector<std::vector<MatShape> > vector_vector_MatShape;
|
||||
|
||||
template<>
|
||||
bool pyopencv_to(PyObject *o, dnn::DictValue &dv, const ArgInfo& info)
|
||||
{
|
||||
CV_UNUSED(info);
|
||||
if (!o || o == Py_None)
|
||||
return true; //Current state will be used
|
||||
else if (PyLong_Check(o))
|
||||
{
|
||||
dv = dnn::DictValue((int64)PyLong_AsLongLong(o));
|
||||
return true;
|
||||
}
|
||||
else if (PyInt_Check(o))
|
||||
{
|
||||
dv = dnn::DictValue((int64)PyInt_AS_LONG(o));
|
||||
return true;
|
||||
}
|
||||
else if (PyFloat_Check(o))
|
||||
{
|
||||
dv = dnn::DictValue(PyFloat_AsDouble(o));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string str;
|
||||
if (getUnicodeString(o, str))
|
||||
{
|
||||
dv = dnn::DictValue(str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
PyObject* pyopencv_from(const dnn::DictValue &dv)
|
||||
{
|
||||
if (dv.size() > 1)
|
||||
{
|
||||
std::vector<T> vec(dv.size());
|
||||
for (int i = 0; i < dv.size(); ++i)
|
||||
vec[i] = dv.get<T>(i);
|
||||
return pyopencv_from_generic_vec(vec);
|
||||
}
|
||||
else
|
||||
return pyopencv_from(dv.get<T>());
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const dnn::DictValue &dv)
|
||||
{
|
||||
if (dv.isInt()) return pyopencv_from<int>(dv);
|
||||
if (dv.isReal()) return pyopencv_from<float>(dv);
|
||||
if (dv.isString()) return pyopencv_from<String>(dv);
|
||||
CV_Error(Error::StsNotImplemented, "Unknown value type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const dnn::LayerParams& lp)
|
||||
{
|
||||
PyObject* dict = PyDict_New();
|
||||
for (std::map<String, dnn::DictValue>::const_iterator it = lp.begin(); it != lp.end(); ++it)
|
||||
{
|
||||
CV_Assert(!PyDict_SetItemString(dict, it->first.c_str(), pyopencv_from(it->second)));
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
template<>
|
||||
bool pyopencv_to(PyObject *o, dnn::LayerParams &lp, const ArgInfo& info)
|
||||
{
|
||||
CV_Assert(PyDict_Check(o));
|
||||
PyObject *key, *value;
|
||||
Py_ssize_t pos = 0;
|
||||
std::string keyName;
|
||||
while (PyDict_Next(o, &pos, &key, &value)) {
|
||||
getUnicodeString(key, keyName);
|
||||
dnn::DictValue dv;
|
||||
pyopencv_to(value, dv, info);
|
||||
lp.set(keyName, dv);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<>
|
||||
PyObject* pyopencv_from(const std::vector<dnn::Target> &t)
|
||||
{
|
||||
return pyopencv_from(std::vector<int>(t.begin(), t.end()));
|
||||
}
|
||||
|
||||
class pycvLayer CV_FINAL : public dnn::Layer
|
||||
{
|
||||
public:
|
||||
pycvLayer(const dnn::LayerParams ¶ms, PyObject* pyLayer) : Layer(params)
|
||||
{
|
||||
PyGILState_STATE gstate;
|
||||
gstate = PyGILState_Ensure();
|
||||
|
||||
PyObject* args = PyTuple_New(2);
|
||||
CV_Assert(!PyTuple_SetItem(args, 0, pyopencv_from(params)));
|
||||
CV_Assert(!PyTuple_SetItem(args, 1, pyopencv_from(params.blobs)));
|
||||
o = PyObject_CallObject(pyLayer, args);
|
||||
|
||||
Py_DECREF(args);
|
||||
PyGILState_Release(gstate);
|
||||
if (!o)
|
||||
CV_Error(Error::StsError, "Failed to create an instance of custom layer");
|
||||
}
|
||||
|
||||
static void registerLayer(const std::string& type, PyObject* o)
|
||||
{
|
||||
std::map<std::string, std::vector<PyObject*> >::iterator it = pyLayers.find(type);
|
||||
if (it != pyLayers.end())
|
||||
it->second.push_back(o);
|
||||
else
|
||||
pyLayers[type] = std::vector<PyObject*>(1, o);
|
||||
}
|
||||
|
||||
static void unregisterLayer(const std::string& type)
|
||||
{
|
||||
std::map<std::string, std::vector<PyObject*> >::iterator it = pyLayers.find(type);
|
||||
if (it != pyLayers.end())
|
||||
{
|
||||
if (it->second.size() > 1)
|
||||
it->second.pop_back();
|
||||
else
|
||||
pyLayers.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
static Ptr<dnn::Layer> create(dnn::LayerParams ¶ms)
|
||||
{
|
||||
std::map<std::string, std::vector<PyObject*> >::iterator it = pyLayers.find(params.type);
|
||||
if (it == pyLayers.end())
|
||||
CV_Error(Error::StsNotImplemented, "Layer with a type \"" + params.type +
|
||||
"\" is not implemented");
|
||||
CV_Assert(!it->second.empty());
|
||||
return Ptr<dnn::Layer>(new pycvLayer(params, it->second.back()));
|
||||
}
|
||||
|
||||
virtual void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays) CV_OVERRIDE
|
||||
{
|
||||
PyGILState_STATE gstate;
|
||||
gstate = PyGILState_Ensure();
|
||||
|
||||
std::vector<Mat> ins, outs;
|
||||
inputs_arr.getMatVector(ins);
|
||||
outputs_arr.getMatVector(outs);
|
||||
|
||||
PyObject* args = pyopencv_from(ins);
|
||||
PyObject* res = PyObject_CallMethodObjArgs(o, PyString_FromString("forward"), args, NULL);
|
||||
Py_DECREF(args);
|
||||
if (!res)
|
||||
CV_Error(Error::StsNotImplemented, "Failed to call \"forward\" method");
|
||||
|
||||
std::vector<Mat> pyOutputs;
|
||||
CV_Assert(pyopencv_to(res, pyOutputs, ArgInfo("", 0)));
|
||||
Py_DECREF(res);
|
||||
PyGILState_Release(gstate);
|
||||
|
||||
CV_Assert(pyOutputs.size() == outs.size());
|
||||
for (size_t i = 0; i < outs.size(); ++i)
|
||||
{
|
||||
CV_Assert(pyOutputs[i].size == outs[i].size);
|
||||
CV_Assert(pyOutputs[i].type() == outs[i].type());
|
||||
pyOutputs[i].copyTo(outs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Map layers types to python classes.
|
||||
static std::map<std::string, std::vector<PyObject*> > pyLayers;
|
||||
PyObject* o; // Instance of implemented python layer.
|
||||
};
|
||||
|
||||
std::map<std::string, std::vector<PyObject*> > pycvLayer::pyLayers;
|
||||
|
||||
static PyObject *pyopencv_cv_dnn_registerLayer(PyObject*, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const char *keywords[] = { "type", "class", NULL };
|
||||
char* layerType;
|
||||
PyObject *classInstance;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "sO", (char**)keywords, &layerType, &classInstance))
|
||||
return NULL;
|
||||
if (!PyCallable_Check(classInstance)) {
|
||||
PyErr_SetString(PyExc_TypeError, "class must be callable");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pycvLayer::registerLayer(layerType, classInstance);
|
||||
dnn::LayerFactory::registerLayer(layerType, pycvLayer::create);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *pyopencv_cv_dnn_unregisterLayer(PyObject*, PyObject *args, PyObject *kw)
|
||||
{
|
||||
const char *keywords[] = { "type", NULL };
|
||||
char* layerType;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "s", (char**)keywords, &layerType))
|
||||
return NULL;
|
||||
|
||||
pycvLayer::unregisterLayer(layerType);
|
||||
dnn::LayerFactory::unregisterLayer(layerType);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#endif // HAVE_OPENCV_DNN
|
||||
Executable
+474
@@ -0,0 +1,474 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
from tests_common import NewOpenCVTests, unittest
|
||||
|
||||
def normAssert(test, a, b, msg=None, lInf=1e-5):
|
||||
test.assertLess(np.max(np.abs(a - b)), lInf, msg)
|
||||
|
||||
def inter_area(box1, box2):
|
||||
x_min, x_max = max(box1[0], box2[0]), min(box1[2], box2[2])
|
||||
y_min, y_max = max(box1[1], box2[1]), min(box1[3], box2[3])
|
||||
return (x_max - x_min) * (y_max - y_min)
|
||||
|
||||
def area(box):
|
||||
return (box[2] - box[0]) * (box[3] - box[1])
|
||||
|
||||
def box2str(box):
|
||||
left, top = box[0], box[1]
|
||||
width, height = box[2] - left, box[3] - top
|
||||
return '[%f x %f from (%f, %f)]' % (width, height, left, top)
|
||||
|
||||
def normAssertDetections(test, refClassIds, refScores, refBoxes, testClassIds, testScores, testBoxes,
|
||||
confThreshold=0.0, scores_diff=1e-5, boxes_iou_diff=1e-4):
|
||||
matchedRefBoxes = [False] * len(refBoxes)
|
||||
errMsg = ''
|
||||
for i in range(len(testBoxes)):
|
||||
testScore = testScores[i]
|
||||
if testScore < confThreshold:
|
||||
continue
|
||||
|
||||
testClassId, testBox = testClassIds[i], testBoxes[i]
|
||||
matched = False
|
||||
for j in range(len(refBoxes)):
|
||||
if (not matchedRefBoxes[j]) and testClassId == refClassIds[j] and \
|
||||
abs(testScore - refScores[j]) < scores_diff:
|
||||
interArea = inter_area(testBox, refBoxes[j])
|
||||
iou = interArea / (area(testBox) + area(refBoxes[j]) - interArea)
|
||||
if abs(iou - 1.0) < boxes_iou_diff:
|
||||
matched = True
|
||||
matchedRefBoxes[j] = True
|
||||
if not matched:
|
||||
errMsg += '\nUnmatched prediction: class %d score %f box %s' % (testClassId, testScore, box2str(testBox))
|
||||
|
||||
for i in range(len(refBoxes)):
|
||||
if (not matchedRefBoxes[i]) and refScores[i] > confThreshold:
|
||||
errMsg += '\nUnmatched reference: class %d score %f box %s' % (refClassIds[i], refScores[i], box2str(refBoxes[i]))
|
||||
if errMsg:
|
||||
test.fail(errMsg)
|
||||
|
||||
def printParams(backend, target):
|
||||
backendNames = {
|
||||
cv.dnn.DNN_BACKEND_OPENCV: 'OCV',
|
||||
cv.dnn.DNN_BACKEND_INFERENCE_ENGINE: 'DLIE'
|
||||
}
|
||||
targetNames = {
|
||||
cv.dnn.DNN_TARGET_CPU: 'CPU',
|
||||
cv.dnn.DNN_TARGET_OPENCL: 'OCL',
|
||||
cv.dnn.DNN_TARGET_OPENCL_FP16: 'OCL_FP16',
|
||||
cv.dnn.DNN_TARGET_MYRIAD: 'MYRIAD'
|
||||
}
|
||||
print('%s/%s' % (backendNames[backend], targetNames[target]))
|
||||
|
||||
def getDefaultThreshold(target):
|
||||
if target == cv.dnn.DNN_TARGET_OPENCL_FP16 or target == cv.dnn.DNN_TARGET_MYRIAD:
|
||||
return 4e-3
|
||||
else:
|
||||
return 1e-5
|
||||
|
||||
testdata_required = bool(os.environ.get('OPENCV_DNN_TEST_REQUIRE_TESTDATA', False))
|
||||
|
||||
g_dnnBackendsAndTargets = None
|
||||
|
||||
class dnn_test(NewOpenCVTests):
|
||||
|
||||
def setUp(self):
|
||||
super(dnn_test, self).setUp()
|
||||
|
||||
global g_dnnBackendsAndTargets
|
||||
if g_dnnBackendsAndTargets is None:
|
||||
g_dnnBackendsAndTargets = self.initBackendsAndTargets()
|
||||
self.dnnBackendsAndTargets = g_dnnBackendsAndTargets
|
||||
|
||||
def checkIETarget(self, backend, target):
|
||||
# OpenVINO is optional; a target is usable only if its backend lists it.
|
||||
try:
|
||||
return target in cv.dnn.getAvailableTargets(backend)
|
||||
except BaseException:
|
||||
return False
|
||||
|
||||
def initBackendsAndTargets(self):
|
||||
self.dnnBackendsAndTargets = [
|
||||
[cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_CPU],
|
||||
]
|
||||
|
||||
if self.checkIETarget(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_CPU):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_CPU])
|
||||
if self.checkIETarget(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_MYRIAD):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_MYRIAD])
|
||||
|
||||
if cv.ocl.haveOpenCL() and cv.ocl.useOpenCL():
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL])
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
||||
if cv.ocl_Device.getDefault().isIntel():
|
||||
if self.checkIETarget(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL])
|
||||
if self.checkIETarget(cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16):
|
||||
self.dnnBackendsAndTargets.append([cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_TARGET_OPENCL_FP16])
|
||||
return self.dnnBackendsAndTargets
|
||||
|
||||
def find_dnn_file(self, filename, required=True):
|
||||
if not required:
|
||||
required = testdata_required
|
||||
return self.find_file(filename, [os.environ.get('OPENCV_DNN_TEST_DATA_PATH', os.getcwd()),
|
||||
os.environ['OPENCV_TEST_DATA_PATH']],
|
||||
required=required)
|
||||
|
||||
def test_getAvailableTargets(self):
|
||||
targets = cv.dnn.getAvailableTargets(cv.dnn.DNN_BACKEND_OPENCV)
|
||||
self.assertTrue(cv.dnn.DNN_TARGET_CPU in targets)
|
||||
|
||||
def test_blobRectsToImageRects(self):
|
||||
paramNet = cv.dnn.Image2BlobParams()
|
||||
paramNet.size = (226, 226)
|
||||
paramNet.ddepth = cv.CV_32F
|
||||
paramNet.mean = [0.485, 0.456, 0.406]
|
||||
paramNet.scalefactor = [0.229, 0.224, 0.225]
|
||||
paramNet.swapRB = False
|
||||
paramNet.datalayout = cv.DATA_LAYOUT_NCHW
|
||||
paramNet.paddingmode = cv.dnn.DNN_PMODE_LETTERBOX
|
||||
rBlob = np.zeros(shape=(20, 4), dtype=np.int32)
|
||||
rImg = paramNet.blobRectsToImageRects(rBlob, (356, 356))
|
||||
self.assertTrue(type(rImg[0, 0])==np.int32)
|
||||
self.assertTrue(rImg.shape==(20, 4))
|
||||
|
||||
def test_blobRectToImageRect(self):
|
||||
paramNet = cv.dnn.Image2BlobParams()
|
||||
paramNet.size = (226, 226)
|
||||
paramNet.ddepth = cv.CV_32F
|
||||
paramNet.mean = [0.485, 0.456, 0.406]
|
||||
paramNet.scalefactor = [0.229, 0.224, 0.225]
|
||||
paramNet.swapRB = False
|
||||
paramNet.datalayout = cv.DATA_LAYOUT_NCHW
|
||||
paramNet.paddingmode = cv.dnn.DNN_PMODE_LETTERBOX
|
||||
rBlob = np.zeros(shape=(20, 4), dtype=np.int32)
|
||||
rImg = paramNet.blobRectToImageRect((0, 0, 0, 0), (356, 356))
|
||||
self.assertTrue(type(rImg[0])==int)
|
||||
|
||||
|
||||
def test_blobFromImage(self):
|
||||
np.random.seed(324)
|
||||
|
||||
width = 6
|
||||
height = 7
|
||||
scale = 1.0/127.5
|
||||
mean = (10, 20, 30)
|
||||
|
||||
# Test arguments names.
|
||||
img = np.random.randint(0, 255, [4, 5, 3]).astype(np.uint8)
|
||||
blob = cv.dnn.blobFromImage(img, scale, (width, height), mean, True, False)
|
||||
blob_args = cv.dnn.blobFromImage(img, scalefactor=scale, size=(width, height),
|
||||
mean=mean, swapRB=True, crop=False)
|
||||
normAssert(self, blob, blob_args)
|
||||
|
||||
# Test values.
|
||||
target = cv.resize(img, (width, height), interpolation=cv.INTER_LINEAR)
|
||||
target = target.astype(np.float32)
|
||||
target = target[:,:,[2, 1, 0]] # BGR2RGB
|
||||
target[:,:,0] -= mean[0]
|
||||
target[:,:,1] -= mean[1]
|
||||
target[:,:,2] -= mean[2]
|
||||
target *= scale
|
||||
target = target.transpose(2, 0, 1).reshape(1, 3, height, width) # to NCHW
|
||||
normAssert(self, blob, target)
|
||||
|
||||
def test_blobFromImageWithParams(self):
|
||||
np.random.seed(324)
|
||||
|
||||
width = 6
|
||||
height = 7
|
||||
stddev = np.array([0.2, 0.3, 0.4])
|
||||
scalefactor = 1.0/127.5 * stddev
|
||||
mean = (10, 20, 30)
|
||||
|
||||
# Test arguments names.
|
||||
img = np.random.randint(0, 255, [4, 5, 3]).astype(np.uint8)
|
||||
|
||||
param = cv.dnn.Image2BlobParams()
|
||||
param.scalefactor = scalefactor
|
||||
param.size = (6, 7)
|
||||
param.mean = mean
|
||||
param.swapRB=True
|
||||
param.datalayout = cv.DATA_LAYOUT_NHWC
|
||||
|
||||
blob = cv.dnn.blobFromImageWithParams(img, param)
|
||||
blob_args = cv.dnn.blobFromImageWithParams(img, cv.dnn.Image2BlobParams(scalefactor=scalefactor, size=(6, 7), mean=mean,
|
||||
swapRB=True, datalayout=cv.DATA_LAYOUT_NHWC))
|
||||
normAssert(self, blob, blob_args)
|
||||
|
||||
target2 = cv.resize(img, (width, height), interpolation=cv.INTER_LINEAR).astype(np.float32)
|
||||
target2 = target2[:,:,[2, 1, 0]] # BGR2RGB
|
||||
target2[:,:,0] -= mean[0]
|
||||
target2[:,:,1] -= mean[1]
|
||||
target2[:,:,2] -= mean[2]
|
||||
|
||||
target2[:,:,0] *= scalefactor[0]
|
||||
target2[:,:,1] *= scalefactor[1]
|
||||
target2[:,:,2] *= scalefactor[2]
|
||||
target2 = target2.reshape(1, height, width, 3) # to NHWC
|
||||
normAssert(self, blob, target2)
|
||||
|
||||
def test_model(self):
|
||||
img_path = self.find_dnn_file("dnn/street.png")
|
||||
weights = self.find_dnn_file("dnn/onnx/models/ssd_vgg16.onnx", required=False)
|
||||
if weights is None:
|
||||
raise unittest.SkipTest("Missing DNN test files (dnn/onnx/models/ssd_vgg16.onnx). Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||
|
||||
frame = cv.imread(img_path)
|
||||
model = cv.dnn_DetectionModel(weights)
|
||||
model.setInputParams(size=(300, 300), mean=(0, 0, 0), scale=1.0, swapRB=False)
|
||||
|
||||
iouDiff = 0.05
|
||||
confThreshold = 0.3
|
||||
nmsThreshold = 0
|
||||
scoreDiff = 5e-3
|
||||
|
||||
classIds, confidences, boxes = model.detect(frame, confThreshold, nmsThreshold)
|
||||
|
||||
refClassIds = (37,)
|
||||
refConfidences = (0.8196,)
|
||||
refBoxes = ((331, 233, 85, 107),)
|
||||
|
||||
normAssertDetections(self, refClassIds, refConfidences, refBoxes,
|
||||
classIds, confidences, boxes,confThreshold, scoreDiff, iouDiff)
|
||||
|
||||
for box in boxes:
|
||||
cv.rectangle(frame, box, (0, 255, 0))
|
||||
cv.rectangle(frame, np.array(box), (0, 255, 0))
|
||||
cv.rectangle(frame, tuple(box), (0, 255, 0))
|
||||
cv.rectangle(frame, list(box), (0, 255, 0))
|
||||
|
||||
|
||||
def test_classification_model(self):
|
||||
img_path = self.find_dnn_file("dnn/googlenet_0.png")
|
||||
weights = self.find_dnn_file("dnn/squeezenet_v1.1.onnx", required=False)
|
||||
ref = np.load(self.find_dnn_file("dnn/squeezenet_v1.1_prob.npy"))
|
||||
if weights is None:
|
||||
raise unittest.SkipTest("Missing DNN test files (dnn/squeezenet_v1.1.onnx). Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||
|
||||
frame = cv.imread(img_path)
|
||||
model = cv.dnn_ClassificationModel(weights)
|
||||
model.setInputSize(227, 227)
|
||||
model.setInputCrop(True)
|
||||
|
||||
out = model.predict(frame)
|
||||
normAssert(self, out, ref)
|
||||
|
||||
|
||||
def test_textdetection_model(self):
|
||||
img_path = self.find_dnn_file("dnn/text_det_test1.png")
|
||||
weights = self.find_dnn_file("dnn/onnx/models/DB_TD500_resnet50.onnx", required=False)
|
||||
if weights is None:
|
||||
raise unittest.SkipTest("Missing DNN test files (onnx/models/DB_TD500_resnet50.onnx). Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||
|
||||
frame = cv.imread(img_path)
|
||||
scale = 1.0 / 255.0
|
||||
size = (736, 736)
|
||||
mean = (122.67891434, 116.66876762, 104.00698793)
|
||||
|
||||
model = cv.dnn_TextDetectionModel_DB(weights)
|
||||
model.setInputParams(scale, size, mean)
|
||||
out, _ = model.detect(frame)
|
||||
|
||||
self.assertTrue(type(out) == tuple, msg='actual type {}'.format(str(type(out))))
|
||||
self.assertTrue(np.array(out).shape == (2, 4, 2))
|
||||
|
||||
|
||||
def test_face_detection(self):
|
||||
model = self.find_dnn_file('dnn/onnx/models/yunet-202605.onnx', required=False)
|
||||
img = self.get_sample('gpu/lbpcascade/er.png')
|
||||
|
||||
ref = [[1, 339.62445, 35.32416, 30.754604, 40.202126, 0.9302596],
|
||||
[1, 140.63962, 255.55545, 32.832615, 41.767395, 0.916015],
|
||||
[1, 68.39314, 126.74046, 30.29324, 39.14823, 0.90639645],
|
||||
[1, 119.57139, 48.482178, 30.600697, 40.485996, 0.906021],
|
||||
[1, 259.0921, 229.30713, 31.088186, 39.74022, 0.90490955],
|
||||
[1, 405.69778, 87.28158, 33.393406, 42.96226, 0.8996978]]
|
||||
|
||||
print('\n')
|
||||
for backend, target in self.dnnBackendsAndTargets:
|
||||
printParams(backend, target)
|
||||
|
||||
net = cv.FaceDetectorYN.create(
|
||||
model=model,
|
||||
config="",
|
||||
input_size=img.shape[:2],
|
||||
score_threshold=0.3,
|
||||
nms_threshold=0.45,
|
||||
top_k=5000,
|
||||
backend_id=backend,
|
||||
target_id=target
|
||||
)
|
||||
|
||||
out = net.detect(img)
|
||||
out = out[1]
|
||||
out = out.reshape(-1, 15)
|
||||
|
||||
ref = np.array(ref, np.float32)
|
||||
refClassIds, testClassIds = ref[:, 0], np.ones(out.shape[0], np.float32)
|
||||
refScores, testScores = ref[:, -1], out[:, -1]
|
||||
refBoxes, testBoxes = ref[:, 1:5], out[:, 0:4]
|
||||
|
||||
normAssertDetections(self, refClassIds, refScores, refBoxes, testClassIds,
|
||||
testScores, testBoxes, 0.5)
|
||||
|
||||
def test_nms(self):
|
||||
confs = (1, 1)
|
||||
rects = ((0, 0, 0.4, 0.4), (0, 0, 0.2, 0.4)) # 0.5 overlap
|
||||
|
||||
self.assertTrue(all(cv.dnn.NMSBoxes(rects, confs, 0, 0.6).ravel() == (0, 1)))
|
||||
|
||||
# BUG: https://github.com/opencv/opencv/issues/26200
|
||||
@unittest.skip("custom layers are partially broken with transition to the new dnn engine")
|
||||
def test_custom_layer(self):
|
||||
class CropLayer(object):
|
||||
def __init__(self, params, blobs):
|
||||
self.xstart = 0
|
||||
self.xend = 0
|
||||
self.ystart = 0
|
||||
self.yend = 0
|
||||
# Our layer receives two inputs. We need to crop the first input blob
|
||||
# to match a shape of the second one (keeping batch size and number of channels)
|
||||
def getMemoryShapes(self, inputs):
|
||||
inputShape, targetShape = inputs[0], inputs[1]
|
||||
batchSize, numChannels = inputShape[0], inputShape[1]
|
||||
height, width = targetShape[2], targetShape[3]
|
||||
self.ystart = (inputShape[2] - targetShape[2]) // 2
|
||||
self.xstart = (inputShape[3] - targetShape[3]) // 2
|
||||
self.yend = self.ystart + height
|
||||
self.xend = self.xstart + width
|
||||
return [[batchSize, numChannels, height, width]]
|
||||
def forward(self, inputs):
|
||||
return [inputs[0][:,:,self.ystart:self.yend,self.xstart:self.xend]]
|
||||
|
||||
cv.dnn_registerLayer('CropCaffe', CropLayer)
|
||||
|
||||
# Skipped: Requires ONNX custom layer multi-input support and Python binding fixes for Net.connect (see #26200).
|
||||
cv.dnn_unregisterLayer('CropCaffe')
|
||||
|
||||
# check that dnn module can work with 3D tensor as input for network
|
||||
def test_input_3d(self):
|
||||
model = self.find_dnn_file('dnn/onnx/models/hidden_lstm.onnx')
|
||||
input_file = self.find_dnn_file('dnn/onnx/data/input_hidden_lstm.npy')
|
||||
output_file = self.find_dnn_file('dnn/onnx/data/output_hidden_lstm.npy')
|
||||
if model is None:
|
||||
raise unittest.SkipTest("Missing DNN test files (dnn/onnx/models/hidden_lstm.onnx). "
|
||||
"Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||
if input_file is None or output_file is None:
|
||||
raise unittest.SkipTest("Missing DNN test files (dnn/onnx/data/{input/output}_hidden_lstm.npy). "
|
||||
"Verify OPENCV_DNN_TEST_DATA_PATH configuration parameter.")
|
||||
|
||||
input = np.load(input_file)
|
||||
gold_output = np.load(output_file)
|
||||
|
||||
for backend, target in self.dnnBackendsAndTargets:
|
||||
printParams(backend, target)
|
||||
|
||||
net = cv.dnn.readNet(model, engine=cv.dnn.ENGINE_CLASSIC)
|
||||
|
||||
net.setPreferableBackend(backend)
|
||||
net.setPreferableTarget(target)
|
||||
|
||||
# Check whether 3d shape is parsed correctly for setInput
|
||||
net.setInput(input)
|
||||
|
||||
# Case 0: test API `forward(const String& outputName = String()`
|
||||
real_output = net.forward() # Retval is a np.array of shape [2, 5, 3]
|
||||
normAssert(self, real_output, gold_output, "Case 1", getDefaultThreshold(target))
|
||||
|
||||
'''
|
||||
Pre-allocate output memory with correct shape.
|
||||
Normally Python users do not use in this way,
|
||||
but we have to test it since we design API in this way
|
||||
'''
|
||||
# Case 1: a np.array with a string of output name.
|
||||
# It tests API `forward(OutputArrayOfArrays outputBlobs, const String& outputName = String()`
|
||||
# when outputBlobs is a np.array and we expect it to be the only output.
|
||||
real_output = np.empty([2, 5, 3], dtype=np.float32)
|
||||
real_output = net.forward(real_output, "237") # Retval is a tuple with a np.array of shape [2, 5, 3]
|
||||
normAssert(self, real_output, gold_output, "Case 1", getDefaultThreshold(target))
|
||||
|
||||
# Case 2: a tuple of np.array with a string of output name.
|
||||
# It tests API `forward(OutputArrayOfArrays outputBlobs, const String& outputName = String()`
|
||||
# when outputBlobs is a container of several np.array and we expect to save all outputs accordingly.
|
||||
real_output = tuple(np.empty([2, 5, 3], dtype=np.float32))
|
||||
real_output = net.forward(real_output, "237") # Retval is a tuple with a np.array of shape [2, 5, 3]
|
||||
normAssert(self, real_output, gold_output, "Case 2", getDefaultThreshold(target))
|
||||
|
||||
# Case 3: a tuple of np.array with a string of output name.
|
||||
# It tests API `forward(OutputArrayOfArrays outputBlobs, const std::vector<String>& outBlobNames)`
|
||||
real_output = tuple(np.empty([2, 5, 3], dtype=np.float32))
|
||||
# Note that it does not support parsing a list , e.g. ["237"]
|
||||
real_output = net.forward(real_output, ("237")) # Retval is a tuple with a np.array of shape [2, 5, 3]
|
||||
normAssert(self, real_output, gold_output, "Case 3", getDefaultThreshold(target))
|
||||
|
||||
def test_set_param_3d(self):
|
||||
model_path = self.find_dnn_file('dnn/onnx/models/matmul_3d_init.onnx')
|
||||
input_file = self.find_dnn_file('dnn/onnx/data/input_matmul_3d_init.npy')
|
||||
output_file = self.find_dnn_file('dnn/onnx/data/output_matmul_3d_init.npy')
|
||||
|
||||
input = np.load(input_file)
|
||||
output = np.load(output_file)
|
||||
|
||||
for backend, target in self.dnnBackendsAndTargets:
|
||||
printParams(backend, target)
|
||||
|
||||
net = cv.dnn.readNet(model_path, "", "", engine=cv.dnn.ENGINE_CLASSIC)
|
||||
|
||||
node_name = net.getLayerNames()[0]
|
||||
w = net.getParam(node_name, 0) # returns the original tensor of three-dimensional shape
|
||||
net.setParam(node_name, 0, w) # set param once again to see whether tensor is converted with correct shape
|
||||
|
||||
net.setPreferableBackend(backend)
|
||||
net.setPreferableTarget(target)
|
||||
|
||||
net.setInput(input)
|
||||
res_output = net.forward()
|
||||
|
||||
normAssert(self, output, res_output, "", getDefaultThreshold(target))
|
||||
|
||||
def test_scalefactor_assign(self):
|
||||
params = cv.dnn.Image2BlobParams()
|
||||
self.assertEqual(params.scalefactor, (1.0, 1.0, 1.0, 1.0))
|
||||
params.scalefactor = 2.0
|
||||
self.assertEqual(params.scalefactor, (2.0, 0.0, 0.0, 0.0))
|
||||
|
||||
def test_net_builder(self):
|
||||
net = cv.dnn.Net()
|
||||
params = {
|
||||
"kernel_w": 3,
|
||||
"kernel_h": 3,
|
||||
"stride_w": 3,
|
||||
"stride_h": 3,
|
||||
"pool": "max",
|
||||
}
|
||||
net.addLayerToPrev("pool", "Pooling", cv.CV_32F, params)
|
||||
|
||||
inp = np.random.standard_normal([1, 2, 9, 12]).astype(np.float32)
|
||||
net.setInput(inp)
|
||||
out = net.forward()
|
||||
self.assertEqual(out.shape, (1, 2, 3, 4))
|
||||
|
||||
def test_bool_operator(self):
|
||||
n = self.find_dnn_file('dnn/onnx/models/and_op.onnx')
|
||||
|
||||
x = np.random.randint(0, 2, [5], dtype=np.bool_)
|
||||
y = np.random.randint(0, 2, [5], dtype=np.bool_)
|
||||
o = x & y
|
||||
|
||||
net = cv.dnn.readNet(n)
|
||||
|
||||
names = ["x", "y"]
|
||||
net.setInputsNames(names)
|
||||
net.setInput(x, names[0])
|
||||
net.setInput(y, names[1])
|
||||
|
||||
out = net.forward()
|
||||
|
||||
self.assertTrue(np.all(out == o))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
@@ -0,0 +1,366 @@
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import argparse
|
||||
import cv2 as cv
|
||||
assert cv.__version__ < "5.0", "Caffe importer is deprecated and removed from OpenCV 5.0"
|
||||
import tensorflow as tf
|
||||
import numpy as np
|
||||
import struct
|
||||
|
||||
if sys.version_info > (3,):
|
||||
long = int
|
||||
|
||||
from tensorflow.python.tools import optimize_for_inference_lib
|
||||
from tensorflow.tools.graph_transforms import TransformGraph
|
||||
from tensorflow.core.framework.node_def_pb2 import NodeDef
|
||||
from google.protobuf import text_format
|
||||
|
||||
parser = argparse.ArgumentParser(description="Use this script to create TensorFlow graph "
|
||||
"with weights from OpenCV's face detection network. "
|
||||
"Only backbone part of SSD model is converted this way. "
|
||||
"Look for .pbtxt configuration file at "
|
||||
"https://github.com/opencv/opencv_extra/tree/5.x/testdata/dnn/opencv_face_detector.pbtxt")
|
||||
parser.add_argument('--model', help='Path to .caffemodel weights', required=True)
|
||||
parser.add_argument('--proto', help='Path to .prototxt Caffe model definition', required=True)
|
||||
parser.add_argument('--pb', help='Path to output .pb TensorFlow model', required=True)
|
||||
parser.add_argument('--pbtxt', help='Path to output .pbxt TensorFlow graph', required=True)
|
||||
parser.add_argument('--quantize', help='Quantize weights to uint8', action='store_true')
|
||||
parser.add_argument('--fp16', help='Convert weights to half precision floats', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
assert(not args.quantize or not args.fp16)
|
||||
|
||||
dtype = tf.float16 if args.fp16 else tf.float32
|
||||
|
||||
################################################################################
|
||||
cvNet = cv.dnn.readNet(args.proto, args.model)
|
||||
|
||||
def dnnLayer(name):
|
||||
return cvNet.getLayer(long(cvNet.getLayerId(name)))
|
||||
|
||||
def scale(x, name):
|
||||
with tf.variable_scope(name):
|
||||
layer = dnnLayer(name)
|
||||
w = tf.Variable(layer.blobs[0].flatten(), dtype=dtype, name='mul')
|
||||
if len(layer.blobs) > 1:
|
||||
b = tf.Variable(layer.blobs[1].flatten(), dtype=dtype, name='add')
|
||||
return tf.nn.bias_add(tf.multiply(x, w), b)
|
||||
else:
|
||||
return tf.multiply(x, w, name)
|
||||
|
||||
def conv(x, name, stride=1, pad='SAME', dilation=1, activ=None):
|
||||
with tf.variable_scope(name):
|
||||
layer = dnnLayer(name)
|
||||
w = tf.Variable(layer.blobs[0].transpose(2, 3, 1, 0), dtype=dtype, name='weights')
|
||||
if dilation == 1:
|
||||
conv = tf.nn.conv2d(x, filter=w, strides=(1, stride, stride, 1), padding=pad)
|
||||
else:
|
||||
assert(stride == 1)
|
||||
conv = tf.nn.atrous_conv2d(x, w, rate=dilation, padding=pad)
|
||||
|
||||
if len(layer.blobs) > 1:
|
||||
b = tf.Variable(layer.blobs[1].flatten(), dtype=dtype, name='bias')
|
||||
conv = tf.nn.bias_add(conv, b)
|
||||
return activ(conv) if activ else conv
|
||||
|
||||
def batch_norm(x, name):
|
||||
with tf.variable_scope(name):
|
||||
# Unfortunately, TensorFlow's batch normalization layer doesn't work with fp16 input.
|
||||
# Here we do a cast to fp32 but remove it in the frozen graph.
|
||||
if x.dtype != tf.float32:
|
||||
x = tf.cast(x, tf.float32)
|
||||
|
||||
layer = dnnLayer(name)
|
||||
assert(len(layer.blobs) >= 3)
|
||||
|
||||
mean = layer.blobs[0].flatten()
|
||||
std = layer.blobs[1].flatten()
|
||||
scale = layer.blobs[2].flatten()
|
||||
|
||||
eps = 1e-5
|
||||
hasBias = len(layer.blobs) > 3
|
||||
hasWeights = scale.shape != (1,)
|
||||
|
||||
if not hasWeights and not hasBias:
|
||||
mean /= scale[0]
|
||||
std /= scale[0]
|
||||
|
||||
mean = tf.Variable(mean, dtype=tf.float32, name='mean')
|
||||
std = tf.Variable(std, dtype=tf.float32, name='std')
|
||||
gamma = tf.Variable(scale if hasWeights else np.ones(mean.shape), dtype=tf.float32, name='gamma')
|
||||
beta = tf.Variable(layer.blobs[3].flatten() if hasBias else np.zeros(mean.shape), dtype=tf.float32, name='beta')
|
||||
bn = tf.nn.fused_batch_norm(x, gamma, beta, mean, std, eps,
|
||||
is_training=False)[0]
|
||||
if bn.dtype != dtype:
|
||||
bn = tf.cast(bn, dtype)
|
||||
return bn
|
||||
|
||||
def l2norm(x, name):
|
||||
with tf.variable_scope(name):
|
||||
layer = dnnLayer(name)
|
||||
w = tf.Variable(layer.blobs[0].flatten(), dtype=dtype, name='mul')
|
||||
return tf.nn.l2_normalize(x, 3, epsilon=1e-10) * w
|
||||
|
||||
### Graph definition ###########################################################
|
||||
inp = tf.placeholder(dtype, [1, 300, 300, 3], 'data')
|
||||
data_bn = batch_norm(inp, 'data_bn')
|
||||
data_scale = scale(data_bn, 'data_scale')
|
||||
|
||||
# Instead of tf.pad we use tf.space_to_batch_nd layers which override convolution's padding strategy to explicit numbers
|
||||
# data_scale = tf.pad(data_scale, [[0, 0], [3, 3], [3, 3], [0, 0]])
|
||||
data_scale = tf.space_to_batch_nd(data_scale, [1, 1], [[3, 3], [3, 3]], name='Pad')
|
||||
conv1_h = conv(data_scale, stride=2, pad='VALID', name='conv1_h')
|
||||
|
||||
conv1_bn_h = batch_norm(conv1_h, 'conv1_bn_h')
|
||||
conv1_scale_h = scale(conv1_bn_h, 'conv1_scale_h')
|
||||
conv1_relu = tf.nn.relu(conv1_scale_h)
|
||||
conv1_pool = tf.layers.max_pooling2d(conv1_relu, pool_size=(3, 3), strides=(2, 2),
|
||||
padding='SAME', name='conv1_pool')
|
||||
|
||||
layer_64_1_conv1_h = conv(conv1_pool, 'layer_64_1_conv1_h')
|
||||
layer_64_1_bn2_h = batch_norm(layer_64_1_conv1_h, 'layer_64_1_bn2_h')
|
||||
layer_64_1_scale2_h = scale(layer_64_1_bn2_h, 'layer_64_1_scale2_h')
|
||||
layer_64_1_relu2 = tf.nn.relu(layer_64_1_scale2_h)
|
||||
layer_64_1_conv2_h = conv(layer_64_1_relu2, 'layer_64_1_conv2_h')
|
||||
layer_64_1_sum = layer_64_1_conv2_h + conv1_pool
|
||||
|
||||
layer_128_1_bn1_h = batch_norm(layer_64_1_sum, 'layer_128_1_bn1_h')
|
||||
layer_128_1_scale1_h = scale(layer_128_1_bn1_h, 'layer_128_1_scale1_h')
|
||||
layer_128_1_relu1 = tf.nn.relu(layer_128_1_scale1_h)
|
||||
layer_128_1_conv1_h = conv(layer_128_1_relu1, stride=2, name='layer_128_1_conv1_h')
|
||||
layer_128_1_bn2 = batch_norm(layer_128_1_conv1_h, 'layer_128_1_bn2')
|
||||
layer_128_1_scale2 = scale(layer_128_1_bn2, 'layer_128_1_scale2')
|
||||
layer_128_1_relu2 = tf.nn.relu(layer_128_1_scale2)
|
||||
layer_128_1_conv2 = conv(layer_128_1_relu2, 'layer_128_1_conv2')
|
||||
layer_128_1_conv_expand_h = conv(layer_128_1_relu1, stride=2, name='layer_128_1_conv_expand_h')
|
||||
layer_128_1_sum = layer_128_1_conv2 + layer_128_1_conv_expand_h
|
||||
|
||||
layer_256_1_bn1 = batch_norm(layer_128_1_sum, 'layer_256_1_bn1')
|
||||
layer_256_1_scale1 = scale(layer_256_1_bn1, 'layer_256_1_scale1')
|
||||
layer_256_1_relu1 = tf.nn.relu(layer_256_1_scale1)
|
||||
|
||||
# layer_256_1_conv1 = tf.pad(layer_256_1_relu1, [[0, 0], [1, 1], [1, 1], [0, 0]])
|
||||
layer_256_1_conv1 = tf.space_to_batch_nd(layer_256_1_relu1, [1, 1], [[1, 1], [1, 1]], name='Pad_1')
|
||||
layer_256_1_conv1 = conv(layer_256_1_conv1, stride=2, pad='VALID', name='layer_256_1_conv1')
|
||||
|
||||
layer_256_1_bn2 = batch_norm(layer_256_1_conv1, 'layer_256_1_bn2')
|
||||
layer_256_1_scale2 = scale(layer_256_1_bn2, 'layer_256_1_scale2')
|
||||
layer_256_1_relu2 = tf.nn.relu(layer_256_1_scale2)
|
||||
layer_256_1_conv2 = conv(layer_256_1_relu2, 'layer_256_1_conv2')
|
||||
layer_256_1_conv_expand = conv(layer_256_1_relu1, stride=2, name='layer_256_1_conv_expand')
|
||||
layer_256_1_sum = layer_256_1_conv2 + layer_256_1_conv_expand
|
||||
|
||||
layer_512_1_bn1 = batch_norm(layer_256_1_sum, 'layer_512_1_bn1')
|
||||
layer_512_1_scale1 = scale(layer_512_1_bn1, 'layer_512_1_scale1')
|
||||
layer_512_1_relu1 = tf.nn.relu(layer_512_1_scale1)
|
||||
layer_512_1_conv1_h = conv(layer_512_1_relu1, 'layer_512_1_conv1_h')
|
||||
layer_512_1_bn2_h = batch_norm(layer_512_1_conv1_h, 'layer_512_1_bn2_h')
|
||||
layer_512_1_scale2_h = scale(layer_512_1_bn2_h, 'layer_512_1_scale2_h')
|
||||
layer_512_1_relu2 = tf.nn.relu(layer_512_1_scale2_h)
|
||||
layer_512_1_conv2_h = conv(layer_512_1_relu2, dilation=2, name='layer_512_1_conv2_h')
|
||||
layer_512_1_conv_expand_h = conv(layer_512_1_relu1, 'layer_512_1_conv_expand_h')
|
||||
layer_512_1_sum = layer_512_1_conv2_h + layer_512_1_conv_expand_h
|
||||
|
||||
last_bn_h = batch_norm(layer_512_1_sum, 'last_bn_h')
|
||||
last_scale_h = scale(last_bn_h, 'last_scale_h')
|
||||
fc7 = tf.nn.relu(last_scale_h, name='last_relu')
|
||||
|
||||
conv6_1_h = conv(fc7, 'conv6_1_h', activ=tf.nn.relu)
|
||||
conv6_2_h = conv(conv6_1_h, stride=2, name='conv6_2_h', activ=tf.nn.relu)
|
||||
conv7_1_h = conv(conv6_2_h, 'conv7_1_h', activ=tf.nn.relu)
|
||||
|
||||
# conv7_2_h = tf.pad(conv7_1_h, [[0, 0], [1, 1], [1, 1], [0, 0]])
|
||||
conv7_2_h = tf.space_to_batch_nd(conv7_1_h, [1, 1], [[1, 1], [1, 1]], name='Pad_2')
|
||||
conv7_2_h = conv(conv7_2_h, stride=2, pad='VALID', name='conv7_2_h', activ=tf.nn.relu)
|
||||
|
||||
conv8_1_h = conv(conv7_2_h, pad='SAME', name='conv8_1_h', activ=tf.nn.relu)
|
||||
conv8_2_h = conv(conv8_1_h, pad='VALID', name='conv8_2_h', activ=tf.nn.relu)
|
||||
conv9_1_h = conv(conv8_2_h, 'conv9_1_h', activ=tf.nn.relu)
|
||||
conv9_2_h = conv(conv9_1_h, pad='VALID', name='conv9_2_h', activ=tf.nn.relu)
|
||||
|
||||
conv4_3_norm = l2norm(layer_256_1_relu1, 'conv4_3_norm')
|
||||
|
||||
### Locations and confidences ##################################################
|
||||
locations = []
|
||||
confidences = []
|
||||
flattenLayersNames = [] # Collect all reshape layers names that should be replaced to flattens.
|
||||
for top, suffix in zip([locations, confidences], ['_mbox_loc', '_mbox_conf']):
|
||||
for bottom, name in zip([conv4_3_norm, fc7, conv6_2_h, conv7_2_h, conv8_2_h, conv9_2_h],
|
||||
['conv4_3_norm', 'fc7', 'conv6_2', 'conv7_2', 'conv8_2', 'conv9_2']):
|
||||
name += suffix
|
||||
flat = tf.layers.flatten(conv(bottom, name))
|
||||
flattenLayersNames.append(flat.name[:flat.name.find(':')])
|
||||
top.append(flat)
|
||||
|
||||
mbox_loc = tf.concat(locations, axis=-1, name='mbox_loc')
|
||||
mbox_conf = tf.concat(confidences, axis=-1, name='mbox_conf')
|
||||
|
||||
total = int(np.prod(mbox_conf.shape[1:]))
|
||||
mbox_conf_reshape = tf.reshape(mbox_conf, [-1, 2], name='mbox_conf_reshape')
|
||||
mbox_conf_softmax = tf.nn.softmax(mbox_conf_reshape, name='mbox_conf_softmax')
|
||||
mbox_conf_flatten = tf.reshape(mbox_conf_softmax, [-1, total], name='mbox_conf_flatten')
|
||||
flattenLayersNames.append('mbox_conf_flatten')
|
||||
|
||||
with tf.Session() as sess:
|
||||
sess.run(tf.global_variables_initializer())
|
||||
|
||||
### Check correctness ######################################################
|
||||
out_nodes = ['mbox_loc', 'mbox_conf_flatten']
|
||||
inp_nodes = [inp.name[:inp.name.find(':')]]
|
||||
|
||||
np.random.seed(2701)
|
||||
inputData = np.random.standard_normal([1, 3, 300, 300]).astype(np.float32)
|
||||
|
||||
cvNet.setInput(inputData)
|
||||
cvNet.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
|
||||
outDNN = cvNet.forward(out_nodes)
|
||||
|
||||
outTF = sess.run([mbox_loc, mbox_conf_flatten], feed_dict={inp: inputData.transpose(0, 2, 3, 1)})
|
||||
print('Max diff @ locations: %e' % np.max(np.abs(outDNN[0] - outTF[0])))
|
||||
print('Max diff @ confidence: %e' % np.max(np.abs(outDNN[1] - outTF[1])))
|
||||
|
||||
# Save a graph
|
||||
graph_def = sess.graph.as_graph_def()
|
||||
|
||||
# Freeze graph. Replaces variables to constants.
|
||||
graph_def = tf.graph_util.convert_variables_to_constants(sess, graph_def, out_nodes)
|
||||
# Optimize graph. Removes training-only ops, unused nodes.
|
||||
graph_def = optimize_for_inference_lib.optimize_for_inference(graph_def, inp_nodes, out_nodes, dtype.as_datatype_enum)
|
||||
# Fuse constant operations.
|
||||
transforms = ["fold_constants(ignore_errors=True)"]
|
||||
if args.quantize:
|
||||
transforms += ["quantize_weights(minimum_size=0)"]
|
||||
transforms += ["sort_by_execution_order"]
|
||||
graph_def = TransformGraph(graph_def, inp_nodes, out_nodes, transforms)
|
||||
|
||||
# By default, float16 weights are stored in repeated tensor's field called
|
||||
# `half_val`. It has type int32 with leading zeros for unused bytes.
|
||||
# This type is encoded by Variant that means only 7 bits are used for value
|
||||
# representation but the last one is indicated the end of encoding. This way
|
||||
# float16 might takes 1 or 2 or 3 bytes depends on value. To improve compression,
|
||||
# we replace all `half_val` values to `tensor_content` using only 2 bytes for everyone.
|
||||
for node in graph_def.node:
|
||||
if 'value' in node.attr:
|
||||
halfs = node.attr["value"].tensor.half_val
|
||||
if not node.attr["value"].tensor.tensor_content and halfs:
|
||||
node.attr["value"].tensor.tensor_content = struct.pack('H' * len(halfs), *halfs)
|
||||
node.attr["value"].tensor.ClearField('half_val')
|
||||
|
||||
# Serialize
|
||||
with tf.gfile.FastGFile(args.pb, 'wb') as f:
|
||||
f.write(graph_def.SerializeToString())
|
||||
|
||||
|
||||
################################################################################
|
||||
# Write a text graph representation
|
||||
################################################################################
|
||||
def tensorMsg(values):
|
||||
msg = 'tensor { dtype: DT_FLOAT tensor_shape { dim { size: %d } }' % len(values)
|
||||
for value in values:
|
||||
msg += 'float_val: %f ' % value
|
||||
return msg + '}'
|
||||
|
||||
# Remove Const nodes and unused attributes.
|
||||
for i in reversed(range(len(graph_def.node))):
|
||||
if graph_def.node[i].op in ['Const', 'Dequantize']:
|
||||
del graph_def.node[i]
|
||||
for attr in ['T', 'data_format', 'Tshape', 'N', 'Tidx', 'Tdim',
|
||||
'use_cudnn_on_gpu', 'Index', 'Tperm', 'is_training',
|
||||
'Tpaddings', 'Tblock_shape', 'Tcrops']:
|
||||
if attr in graph_def.node[i].attr:
|
||||
del graph_def.node[i].attr[attr]
|
||||
|
||||
# Append prior box generators
|
||||
min_sizes = [30, 60, 111, 162, 213, 264]
|
||||
max_sizes = [60, 111, 162, 213, 264, 315]
|
||||
steps = [8, 16, 32, 64, 100, 300]
|
||||
aspect_ratios = [[2], [2, 3], [2, 3], [2, 3], [2], [2]]
|
||||
layers = [conv4_3_norm, fc7, conv6_2_h, conv7_2_h, conv8_2_h, conv9_2_h]
|
||||
for i in range(6):
|
||||
priorBox = NodeDef()
|
||||
priorBox.name = 'PriorBox_%d' % i
|
||||
priorBox.op = 'PriorBox'
|
||||
priorBox.input.append(layers[i].name[:layers[i].name.find(':')])
|
||||
priorBox.input.append(inp_nodes[0]) # data
|
||||
|
||||
text_format.Merge('i: %d' % min_sizes[i], priorBox.attr["min_size"])
|
||||
text_format.Merge('i: %d' % max_sizes[i], priorBox.attr["max_size"])
|
||||
text_format.Merge('b: true', priorBox.attr["flip"])
|
||||
text_format.Merge('b: false', priorBox.attr["clip"])
|
||||
text_format.Merge(tensorMsg(aspect_ratios[i]), priorBox.attr["aspect_ratio"])
|
||||
text_format.Merge(tensorMsg([0.1, 0.1, 0.2, 0.2]), priorBox.attr["variance"])
|
||||
text_format.Merge('f: %f' % steps[i], priorBox.attr["step"])
|
||||
text_format.Merge('f: 0.5', priorBox.attr["offset"])
|
||||
graph_def.node.extend([priorBox])
|
||||
|
||||
# Concatenate prior boxes
|
||||
concat = NodeDef()
|
||||
concat.name = 'mbox_priorbox'
|
||||
concat.op = 'ConcatV2'
|
||||
for i in range(6):
|
||||
concat.input.append('PriorBox_%d' % i)
|
||||
concat.input.append('mbox_loc/axis')
|
||||
graph_def.node.extend([concat])
|
||||
|
||||
# DetectionOutput layer
|
||||
detectionOut = NodeDef()
|
||||
detectionOut.name = 'detection_out'
|
||||
detectionOut.op = 'DetectionOutput'
|
||||
|
||||
detectionOut.input.append('mbox_loc')
|
||||
detectionOut.input.append('mbox_conf_flatten')
|
||||
detectionOut.input.append('mbox_priorbox')
|
||||
|
||||
text_format.Merge('i: 2', detectionOut.attr['num_classes'])
|
||||
text_format.Merge('b: true', detectionOut.attr['share_location'])
|
||||
text_format.Merge('i: 0', detectionOut.attr['background_label_id'])
|
||||
text_format.Merge('f: 0.45', detectionOut.attr['nms_threshold'])
|
||||
text_format.Merge('i: 400', detectionOut.attr['top_k'])
|
||||
text_format.Merge('s: "CENTER_SIZE"', detectionOut.attr['code_type'])
|
||||
text_format.Merge('i: 200', detectionOut.attr['keep_top_k'])
|
||||
text_format.Merge('f: 0.01', detectionOut.attr['confidence_threshold'])
|
||||
|
||||
graph_def.node.extend([detectionOut])
|
||||
|
||||
# Replace L2Normalization subgraph onto a single node.
|
||||
for i in reversed(range(len(graph_def.node))):
|
||||
if graph_def.node[i].name in ['conv4_3_norm/l2_normalize/Square',
|
||||
'conv4_3_norm/l2_normalize/Sum',
|
||||
'conv4_3_norm/l2_normalize/Maximum',
|
||||
'conv4_3_norm/l2_normalize/Rsqrt']:
|
||||
del graph_def.node[i]
|
||||
for node in graph_def.node:
|
||||
if node.name == 'conv4_3_norm/l2_normalize':
|
||||
node.op = 'L2Normalize'
|
||||
node.input.pop()
|
||||
node.input.pop()
|
||||
node.input.append(layer_256_1_relu1.name)
|
||||
node.input.append('conv4_3_norm/l2_normalize/Sum/reduction_indices')
|
||||
break
|
||||
|
||||
softmaxShape = NodeDef()
|
||||
softmaxShape.name = 'reshape_before_softmax'
|
||||
softmaxShape.op = 'Const'
|
||||
text_format.Merge(
|
||||
'tensor {'
|
||||
' dtype: DT_INT32'
|
||||
' tensor_shape { dim { size: 3 } }'
|
||||
' int_val: 0'
|
||||
' int_val: -1'
|
||||
' int_val: 2'
|
||||
'}', softmaxShape.attr["value"])
|
||||
graph_def.node.extend([softmaxShape])
|
||||
|
||||
for node in graph_def.node:
|
||||
if node.name == 'mbox_conf_reshape':
|
||||
node.input[1] = softmaxShape.name
|
||||
elif node.name == 'mbox_conf_softmax':
|
||||
text_format.Merge('i: 2', node.attr['axis'])
|
||||
elif node.name in flattenLayersNames:
|
||||
node.op = 'Flatten'
|
||||
inpName = node.input[0]
|
||||
node.input.pop()
|
||||
node.input.pop()
|
||||
node.input.append(inpName)
|
||||
|
||||
tf.train.write_graph(graph_def, "", args.pbtxt, as_text=True)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,904 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: graph.proto
|
||||
|
||||
#include "graph.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace opencv_tensorflow {
|
||||
constexpr GraphDef::GraphDef(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: node_()
|
||||
, library_(nullptr)
|
||||
, versions_(nullptr)
|
||||
, version_(0){}
|
||||
struct GraphDefDefaultTypeInternal {
|
||||
constexpr GraphDefDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~GraphDefDefaultTypeInternal() {}
|
||||
union {
|
||||
GraphDef _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GraphDefDefaultTypeInternal _GraphDef_default_instance_;
|
||||
constexpr NodeDef_AttrEntry_DoNotUse::NodeDef_AttrEntry_DoNotUse(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){}
|
||||
struct NodeDef_AttrEntry_DoNotUseDefaultTypeInternal {
|
||||
constexpr NodeDef_AttrEntry_DoNotUseDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~NodeDef_AttrEntry_DoNotUseDefaultTypeInternal() {}
|
||||
union {
|
||||
NodeDef_AttrEntry_DoNotUse _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT NodeDef_AttrEntry_DoNotUseDefaultTypeInternal _NodeDef_AttrEntry_DoNotUse_default_instance_;
|
||||
constexpr NodeDef::NodeDef(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: input_()
|
||||
, attr_(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{})
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, op_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, device_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
struct NodeDefDefaultTypeInternal {
|
||||
constexpr NodeDefDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~NodeDefDefaultTypeInternal() {}
|
||||
union {
|
||||
NodeDef _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT NodeDefDefaultTypeInternal _NodeDef_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_graph_2eproto[3];
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_graph_2eproto = nullptr;
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_graph_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_graph_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::GraphDef, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::GraphDef, node_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::GraphDef, versions_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::GraphDef, version_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::GraphDef, library_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse, _has_bits_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse, key_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse, value_),
|
||||
0,
|
||||
1,
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, name_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, op_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, input_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, device_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::NodeDef, attr_),
|
||||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::opencv_tensorflow::GraphDef)},
|
||||
{ 10, 18, -1, sizeof(::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse)},
|
||||
{ 20, -1, -1, sizeof(::opencv_tensorflow::NodeDef)},
|
||||
};
|
||||
|
||||
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_GraphDef_default_instance_),
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_NodeDef_AttrEntry_DoNotUse_default_instance_),
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_NodeDef_default_instance_),
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_graph_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\013graph.proto\022\021opencv_tensorflow\032\020attr_v"
|
||||
"alue.proto\032\016function.proto\032\016versions.pro"
|
||||
"to\"\262\001\n\010GraphDef\022(\n\004node\030\001 \003(\0132\032.opencv_t"
|
||||
"ensorflow.NodeDef\022/\n\010versions\030\004 \001(\0132\035.op"
|
||||
"encv_tensorflow.VersionDef\022\023\n\007version\030\003 "
|
||||
"\001(\005B\002\030\001\0226\n\007library\030\002 \001(\0132%.opencv_tensor"
|
||||
"flow.FunctionDefLibrary\"\301\001\n\007NodeDef\022\014\n\004n"
|
||||
"ame\030\001 \001(\t\022\n\n\002op\030\002 \001(\t\022\r\n\005input\030\003 \003(\t\022\016\n\006"
|
||||
"device\030\004 \001(\t\0222\n\004attr\030\005 \003(\0132$.opencv_tens"
|
||||
"orflow.NodeDef.AttrEntry\032I\n\tAttrEntry\022\013\n"
|
||||
"\003key\030\001 \001(\t\022+\n\005value\030\002 \001(\0132\034.opencv_tenso"
|
||||
"rflow.AttrValue:\0028\001B,\n\030org.tensorflow.fr"
|
||||
"ameworkB\013GraphProtosP\001\370\001\001b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_graph_2eproto_deps[3] = {
|
||||
&::descriptor_table_attr_5fvalue_2eproto,
|
||||
&::descriptor_table_function_2eproto,
|
||||
&::descriptor_table_versions_2eproto,
|
||||
};
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_graph_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_graph_2eproto = {
|
||||
false, false, 513, descriptor_table_protodef_graph_2eproto, "graph.proto",
|
||||
&descriptor_table_graph_2eproto_once, descriptor_table_graph_2eproto_deps, 3, 3,
|
||||
schemas, file_default_instances, TableStruct_graph_2eproto::offsets,
|
||||
file_level_metadata_graph_2eproto, file_level_enum_descriptors_graph_2eproto, file_level_service_descriptors_graph_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_graph_2eproto_getter() {
|
||||
return &descriptor_table_graph_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_graph_2eproto(&descriptor_table_graph_2eproto);
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class GraphDef::_Internal {
|
||||
public:
|
||||
static const ::opencv_tensorflow::VersionDef& versions(const GraphDef* msg);
|
||||
static const ::opencv_tensorflow::FunctionDefLibrary& library(const GraphDef* msg);
|
||||
};
|
||||
|
||||
const ::opencv_tensorflow::VersionDef&
|
||||
GraphDef::_Internal::versions(const GraphDef* msg) {
|
||||
return *msg->versions_;
|
||||
}
|
||||
const ::opencv_tensorflow::FunctionDefLibrary&
|
||||
GraphDef::_Internal::library(const GraphDef* msg) {
|
||||
return *msg->library_;
|
||||
}
|
||||
void GraphDef::clear_versions() {
|
||||
if (GetArenaForAllocation() == nullptr && versions_ != nullptr) {
|
||||
delete versions_;
|
||||
}
|
||||
versions_ = nullptr;
|
||||
}
|
||||
void GraphDef::clear_library() {
|
||||
if (GetArenaForAllocation() == nullptr && library_ != nullptr) {
|
||||
delete library_;
|
||||
}
|
||||
library_ = nullptr;
|
||||
}
|
||||
GraphDef::GraphDef(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
|
||||
node_(arena) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.GraphDef)
|
||||
}
|
||||
GraphDef::GraphDef(const GraphDef& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(),
|
||||
node_(from.node_) {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
if (from._internal_has_library()) {
|
||||
library_ = new ::opencv_tensorflow::FunctionDefLibrary(*from.library_);
|
||||
} else {
|
||||
library_ = nullptr;
|
||||
}
|
||||
if (from._internal_has_versions()) {
|
||||
versions_ = new ::opencv_tensorflow::VersionDef(*from.versions_);
|
||||
} else {
|
||||
versions_ = nullptr;
|
||||
}
|
||||
version_ = from.version_;
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.GraphDef)
|
||||
}
|
||||
|
||||
inline void GraphDef::SharedCtor() {
|
||||
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&library_) - reinterpret_cast<char*>(this)),
|
||||
0, static_cast<size_t>(reinterpret_cast<char*>(&version_) -
|
||||
reinterpret_cast<char*>(&library_)) + sizeof(version_));
|
||||
}
|
||||
|
||||
GraphDef::~GraphDef() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.GraphDef)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void GraphDef::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
if (this != internal_default_instance()) delete library_;
|
||||
if (this != internal_default_instance()) delete versions_;
|
||||
}
|
||||
|
||||
void GraphDef::ArenaDtor(void* object) {
|
||||
GraphDef* _this = reinterpret_cast< GraphDef* >(object);
|
||||
(void)_this;
|
||||
}
|
||||
void GraphDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
|
||||
}
|
||||
void GraphDef::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void GraphDef::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.GraphDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
node_.Clear();
|
||||
if (GetArenaForAllocation() == nullptr && library_ != nullptr) {
|
||||
delete library_;
|
||||
}
|
||||
library_ = nullptr;
|
||||
if (GetArenaForAllocation() == nullptr && versions_ != nullptr) {
|
||||
delete versions_;
|
||||
}
|
||||
versions_ = nullptr;
|
||||
version_ = 0;
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* GraphDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// repeated .opencv_tensorflow.NodeDef node = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(_internal_add_node(), ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// .opencv_tensorflow.FunctionDefLibrary library = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
|
||||
ptr = ctx->ParseMessage(_internal_mutable_library(), ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 version = 3 [deprecated = true];
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
|
||||
version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// .opencv_tensorflow.VersionDef versions = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
|
||||
ptr = ctx->ParseMessage(_internal_mutable_versions(), ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* GraphDef::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.GraphDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .opencv_tensorflow.NodeDef node = 1;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->_internal_node_size()); i < n; i++) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(1, this->_internal_node(i), target, stream);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.FunctionDefLibrary library = 2;
|
||||
if (this->_internal_has_library()) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(
|
||||
2, _Internal::library(this), target, stream);
|
||||
}
|
||||
|
||||
// int32 version = 3 [deprecated = true];
|
||||
if (this->_internal_version() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_version(), target);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.VersionDef versions = 4;
|
||||
if (this->_internal_has_versions()) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(
|
||||
4, _Internal::versions(this), target, stream);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.GraphDef)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t GraphDef::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.GraphDef)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .opencv_tensorflow.NodeDef node = 1;
|
||||
total_size += 1UL * this->_internal_node_size();
|
||||
for (const auto& msg : this->node_) {
|
||||
total_size +=
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.FunctionDefLibrary library = 2;
|
||||
if (this->_internal_has_library()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
|
||||
*library_);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.VersionDef versions = 4;
|
||||
if (this->_internal_has_versions()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
|
||||
*versions_);
|
||||
}
|
||||
|
||||
// int32 version = 3 [deprecated = true];
|
||||
if (this->_internal_version() != 0) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_version());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GraphDef::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
GraphDef::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GraphDef::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void GraphDef::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<GraphDef *>(to)->MergeFrom(
|
||||
static_cast<const GraphDef &>(from));
|
||||
}
|
||||
|
||||
|
||||
void GraphDef::MergeFrom(const GraphDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.GraphDef)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
node_.MergeFrom(from.node_);
|
||||
if (from._internal_has_library()) {
|
||||
_internal_mutable_library()->::opencv_tensorflow::FunctionDefLibrary::MergeFrom(from._internal_library());
|
||||
}
|
||||
if (from._internal_has_versions()) {
|
||||
_internal_mutable_versions()->::opencv_tensorflow::VersionDef::MergeFrom(from._internal_versions());
|
||||
}
|
||||
if (from._internal_version() != 0) {
|
||||
_internal_set_version(from._internal_version());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void GraphDef::CopyFrom(const GraphDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.GraphDef)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool GraphDef::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void GraphDef::InternalSwap(GraphDef* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
node_.InternalSwap(&other->node_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(GraphDef, version_)
|
||||
+ sizeof(GraphDef::version_)
|
||||
- PROTOBUF_FIELD_OFFSET(GraphDef, library_)>(
|
||||
reinterpret_cast<char*>(&library_),
|
||||
reinterpret_cast<char*>(&other->library_));
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GraphDef::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_graph_2eproto_getter, &descriptor_table_graph_2eproto_once,
|
||||
file_level_metadata_graph_2eproto[0]);
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
NodeDef_AttrEntry_DoNotUse::NodeDef_AttrEntry_DoNotUse() {}
|
||||
NodeDef_AttrEntry_DoNotUse::NodeDef_AttrEntry_DoNotUse(::PROTOBUF_NAMESPACE_ID::Arena* arena)
|
||||
: SuperType(arena) {}
|
||||
void NodeDef_AttrEntry_DoNotUse::MergeFrom(const NodeDef_AttrEntry_DoNotUse& other) {
|
||||
MergeFromInternal(other);
|
||||
}
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata NodeDef_AttrEntry_DoNotUse::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_graph_2eproto_getter, &descriptor_table_graph_2eproto_once,
|
||||
file_level_metadata_graph_2eproto[1]);
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class NodeDef::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
void NodeDef::clear_attr() {
|
||||
attr_.Clear();
|
||||
}
|
||||
NodeDef::NodeDef(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
|
||||
input_(arena),
|
||||
attr_(arena) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.NodeDef)
|
||||
}
|
||||
NodeDef::NodeDef(const NodeDef& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(),
|
||||
input_(from.input_) {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
attr_.MergeFrom(from.attr_);
|
||||
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
}
|
||||
op_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
op_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_op().empty()) {
|
||||
op_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_op(),
|
||||
GetArenaForAllocation());
|
||||
}
|
||||
device_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
device_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_device().empty()) {
|
||||
device_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_device(),
|
||||
GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.NodeDef)
|
||||
}
|
||||
|
||||
inline void NodeDef::SharedCtor() {
|
||||
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
op_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
op_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
device_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
device_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
}
|
||||
|
||||
NodeDef::~NodeDef() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.NodeDef)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void NodeDef::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
op_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
device_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
|
||||
void NodeDef::ArenaDtor(void* object) {
|
||||
NodeDef* _this = reinterpret_cast< NodeDef* >(object);
|
||||
(void)_this;
|
||||
_this->attr_. ~MapField();
|
||||
}
|
||||
inline void NodeDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena) {
|
||||
if (arena != nullptr) {
|
||||
arena->OwnCustomDestructor(this, &NodeDef::ArenaDtor);
|
||||
}
|
||||
}
|
||||
void NodeDef::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void NodeDef::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.NodeDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
input_.Clear();
|
||||
attr_.Clear();
|
||||
name_.ClearToEmpty();
|
||||
op_.ClearToEmpty();
|
||||
device_.ClearToEmpty();
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* NodeDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// string name = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
|
||||
auto str = _internal_mutable_name();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "opencv_tensorflow.NodeDef.name"));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// string op = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
|
||||
auto str = _internal_mutable_op();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "opencv_tensorflow.NodeDef.op"));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated string input = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
auto str = _internal_add_input();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "opencv_tensorflow.NodeDef.input"));
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// string device = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
|
||||
auto str = _internal_mutable_device();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "opencv_tensorflow.NodeDef.device"));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// map<string, .opencv_tensorflow.AttrValue> attr = 5;
|
||||
case 5:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(&attr_, ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* NodeDef::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.NodeDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// string name = 1;
|
||||
if (!this->_internal_name().empty()) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.NodeDef.name");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
1, this->_internal_name(), target);
|
||||
}
|
||||
|
||||
// string op = 2;
|
||||
if (!this->_internal_op().empty()) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_op().data(), static_cast<int>(this->_internal_op().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.NodeDef.op");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
2, this->_internal_op(), target);
|
||||
}
|
||||
|
||||
// repeated string input = 3;
|
||||
for (int i = 0, n = this->_internal_input_size(); i < n; i++) {
|
||||
const auto& s = this->_internal_input(i);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
s.data(), static_cast<int>(s.length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.NodeDef.input");
|
||||
target = stream->WriteString(3, s, target);
|
||||
}
|
||||
|
||||
// string device = 4;
|
||||
if (!this->_internal_device().empty()) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_device().data(), static_cast<int>(this->_internal_device().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.NodeDef.device");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
4, this->_internal_device(), target);
|
||||
}
|
||||
|
||||
// map<string, .opencv_tensorflow.AttrValue> attr = 5;
|
||||
if (!this->_internal_attr().empty()) {
|
||||
typedef ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::opencv_tensorflow::AttrValue >::const_pointer
|
||||
ConstPtr;
|
||||
typedef ConstPtr SortItem;
|
||||
typedef ::PROTOBUF_NAMESPACE_ID::internal::CompareByDerefFirst<SortItem> Less;
|
||||
struct Utf8Check {
|
||||
static void Check(ConstPtr p) {
|
||||
(void)p;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
p->first.data(), static_cast<int>(p->first.length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.NodeDef.AttrEntry.key");
|
||||
}
|
||||
};
|
||||
|
||||
if (stream->IsSerializationDeterministic() &&
|
||||
this->_internal_attr().size() > 1) {
|
||||
::std::unique_ptr<SortItem[]> items(
|
||||
new SortItem[this->_internal_attr().size()]);
|
||||
typedef ::PROTOBUF_NAMESPACE_ID::Map< std::string, ::opencv_tensorflow::AttrValue >::size_type size_type;
|
||||
size_type n = 0;
|
||||
for (::PROTOBUF_NAMESPACE_ID::Map< std::string, ::opencv_tensorflow::AttrValue >::const_iterator
|
||||
it = this->_internal_attr().begin();
|
||||
it != this->_internal_attr().end(); ++it, ++n) {
|
||||
items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
|
||||
}
|
||||
::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
|
||||
for (size_type i = 0; i < n; i++) {
|
||||
target = NodeDef_AttrEntry_DoNotUse::Funcs::InternalSerialize(5, items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second, target, stream);
|
||||
Utf8Check::Check(&(*items[static_cast<ptrdiff_t>(i)]));
|
||||
}
|
||||
} else {
|
||||
for (::PROTOBUF_NAMESPACE_ID::Map< std::string, ::opencv_tensorflow::AttrValue >::const_iterator
|
||||
it = this->_internal_attr().begin();
|
||||
it != this->_internal_attr().end(); ++it) {
|
||||
target = NodeDef_AttrEntry_DoNotUse::Funcs::InternalSerialize(5, it->first, it->second, target, stream);
|
||||
Utf8Check::Check(&(*it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.NodeDef)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t NodeDef::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.NodeDef)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated string input = 3;
|
||||
total_size += 1 *
|
||||
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(input_.size());
|
||||
for (int i = 0, n = input_.size(); i < n; i++) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
input_.Get(i));
|
||||
}
|
||||
|
||||
// map<string, .opencv_tensorflow.AttrValue> attr = 5;
|
||||
total_size += 1 *
|
||||
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_attr_size());
|
||||
for (::PROTOBUF_NAMESPACE_ID::Map< std::string, ::opencv_tensorflow::AttrValue >::const_iterator
|
||||
it = this->_internal_attr().begin();
|
||||
it != this->_internal_attr().end(); ++it) {
|
||||
total_size += NodeDef_AttrEntry_DoNotUse::Funcs::ByteSizeLong(it->first, it->second);
|
||||
}
|
||||
|
||||
// string name = 1;
|
||||
if (!this->_internal_name().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_name());
|
||||
}
|
||||
|
||||
// string op = 2;
|
||||
if (!this->_internal_op().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_op());
|
||||
}
|
||||
|
||||
// string device = 4;
|
||||
if (!this->_internal_device().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_device());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData NodeDef::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
NodeDef::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*NodeDef::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void NodeDef::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<NodeDef *>(to)->MergeFrom(
|
||||
static_cast<const NodeDef &>(from));
|
||||
}
|
||||
|
||||
|
||||
void NodeDef::MergeFrom(const NodeDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.NodeDef)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
input_.MergeFrom(from.input_);
|
||||
attr_.MergeFrom(from.attr_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (!from._internal_op().empty()) {
|
||||
_internal_set_op(from._internal_op());
|
||||
}
|
||||
if (!from._internal_device().empty()) {
|
||||
_internal_set_device(from._internal_device());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void NodeDef::CopyFrom(const NodeDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.NodeDef)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool NodeDef::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void NodeDef::InternalSwap(NodeDef* other) {
|
||||
using std::swap;
|
||||
auto* lhs_arena = GetArenaForAllocation();
|
||||
auto* rhs_arena = other->GetArenaForAllocation();
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
input_.InternalSwap(&other->input_);
|
||||
attr_.InternalSwap(&other->attr_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
&name_, lhs_arena,
|
||||
&other->name_, rhs_arena
|
||||
);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
&op_, lhs_arena,
|
||||
&other->op_, rhs_arena
|
||||
);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
&device_, lhs_arena,
|
||||
&other->device_, rhs_arena
|
||||
);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata NodeDef::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_graph_2eproto_getter, &descriptor_table_graph_2eproto_once,
|
||||
file_level_metadata_graph_2eproto[2]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::GraphDef* Arena::CreateMaybeMessage< ::opencv_tensorflow::GraphDef >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::GraphDef >(arena);
|
||||
}
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse* Arena::CreateMaybeMessage< ::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::NodeDef_AttrEntry_DoNotUse >(arena);
|
||||
}
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::NodeDef* Arena::CreateMaybeMessage< ::opencv_tensorflow::NodeDef >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::NodeDef >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,751 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: tensor.proto
|
||||
|
||||
#include "tensor.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace opencv_tensorflow {
|
||||
constexpr TensorProto::TensorProto(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: float_val_()
|
||||
, double_val_()
|
||||
, int_val_()
|
||||
, _int_val_cached_byte_size_(0)
|
||||
, string_val_()
|
||||
, scomplex_val_()
|
||||
, int64_val_()
|
||||
, _int64_val_cached_byte_size_(0)
|
||||
, bool_val_()
|
||||
, dcomplex_val_()
|
||||
, half_val_()
|
||||
, _half_val_cached_byte_size_(0)
|
||||
, tensor_content_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, tensor_shape_(nullptr)
|
||||
, dtype_(0)
|
||||
|
||||
, version_number_(0){}
|
||||
struct TensorProtoDefaultTypeInternal {
|
||||
constexpr TensorProtoDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~TensorProtoDefaultTypeInternal() {}
|
||||
union {
|
||||
TensorProto _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT TensorProtoDefaultTypeInternal _TensorProto_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_tensor_2eproto[1];
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_tensor_2eproto = nullptr;
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_tensor_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_tensor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, dtype_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, tensor_shape_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, version_number_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, tensor_content_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, half_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, float_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, double_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, int_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, string_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, scomplex_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, int64_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, bool_val_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorProto, dcomplex_val_),
|
||||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::opencv_tensorflow::TensorProto)},
|
||||
};
|
||||
|
||||
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_TensorProto_default_instance_),
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_tensor_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\014tensor.proto\022\021opencv_tensorflow\032\022tenso"
|
||||
"r_shape.proto\032\013types.proto\"\363\002\n\013TensorPro"
|
||||
"to\022*\n\005dtype\030\001 \001(\0162\033.opencv_tensorflow.Da"
|
||||
"taType\0229\n\014tensor_shape\030\002 \001(\0132#.opencv_te"
|
||||
"nsorflow.TensorShapeProto\022\026\n\016version_num"
|
||||
"ber\030\003 \001(\005\022\026\n\016tensor_content\030\004 \001(\014\022\024\n\010hal"
|
||||
"f_val\030\r \003(\005B\002\020\001\022\025\n\tfloat_val\030\005 \003(\002B\002\020\001\022\026"
|
||||
"\n\ndouble_val\030\006 \003(\001B\002\020\001\022\023\n\007int_val\030\007 \003(\005B"
|
||||
"\002\020\001\022\022\n\nstring_val\030\010 \003(\014\022\030\n\014scomplex_val\030"
|
||||
"\t \003(\002B\002\020\001\022\025\n\tint64_val\030\n \003(\003B\002\020\001\022\024\n\010bool"
|
||||
"_val\030\013 \003(\010B\002\020\001\022\030\n\014dcomplex_val\030\014 \003(\001B\002\020\001"
|
||||
"B-\n\030org.tensorflow.frameworkB\014TensorProt"
|
||||
"osP\001\370\001\001b\006proto3"
|
||||
;
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_tensor_2eproto_deps[2] = {
|
||||
&::descriptor_table_tensor_5fshape_2eproto,
|
||||
&::descriptor_table_types_2eproto,
|
||||
};
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_tensor_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensor_2eproto = {
|
||||
false, false, 495, descriptor_table_protodef_tensor_2eproto, "tensor.proto",
|
||||
&descriptor_table_tensor_2eproto_once, descriptor_table_tensor_2eproto_deps, 2, 1,
|
||||
schemas, file_default_instances, TableStruct_tensor_2eproto::offsets,
|
||||
file_level_metadata_tensor_2eproto, file_level_enum_descriptors_tensor_2eproto, file_level_service_descriptors_tensor_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_tensor_2eproto_getter() {
|
||||
return &descriptor_table_tensor_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_tensor_2eproto(&descriptor_table_tensor_2eproto);
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TensorProto::_Internal {
|
||||
public:
|
||||
static const ::opencv_tensorflow::TensorShapeProto& tensor_shape(const TensorProto* msg);
|
||||
};
|
||||
|
||||
const ::opencv_tensorflow::TensorShapeProto&
|
||||
TensorProto::_Internal::tensor_shape(const TensorProto* msg) {
|
||||
return *msg->tensor_shape_;
|
||||
}
|
||||
void TensorProto::clear_tensor_shape() {
|
||||
if (GetArenaForAllocation() == nullptr && tensor_shape_ != nullptr) {
|
||||
delete tensor_shape_;
|
||||
}
|
||||
tensor_shape_ = nullptr;
|
||||
}
|
||||
TensorProto::TensorProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
|
||||
float_val_(arena),
|
||||
double_val_(arena),
|
||||
int_val_(arena),
|
||||
string_val_(arena),
|
||||
scomplex_val_(arena),
|
||||
int64_val_(arena),
|
||||
bool_val_(arena),
|
||||
dcomplex_val_(arena),
|
||||
half_val_(arena) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.TensorProto)
|
||||
}
|
||||
TensorProto::TensorProto(const TensorProto& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(),
|
||||
float_val_(from.float_val_),
|
||||
double_val_(from.double_val_),
|
||||
int_val_(from.int_val_),
|
||||
string_val_(from.string_val_),
|
||||
scomplex_val_(from.scomplex_val_),
|
||||
int64_val_(from.int64_val_),
|
||||
bool_val_(from.bool_val_),
|
||||
dcomplex_val_(from.dcomplex_val_),
|
||||
half_val_(from.half_val_) {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
tensor_content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
tensor_content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_tensor_content().empty()) {
|
||||
tensor_content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_tensor_content(),
|
||||
GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_tensor_shape()) {
|
||||
tensor_shape_ = new ::opencv_tensorflow::TensorShapeProto(*from.tensor_shape_);
|
||||
} else {
|
||||
tensor_shape_ = nullptr;
|
||||
}
|
||||
::memcpy(&dtype_, &from.dtype_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&version_number_) -
|
||||
reinterpret_cast<char*>(&dtype_)) + sizeof(version_number_));
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.TensorProto)
|
||||
}
|
||||
|
||||
inline void TensorProto::SharedCtor() {
|
||||
tensor_content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
tensor_content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&tensor_shape_) - reinterpret_cast<char*>(this)),
|
||||
0, static_cast<size_t>(reinterpret_cast<char*>(&version_number_) -
|
||||
reinterpret_cast<char*>(&tensor_shape_)) + sizeof(version_number_));
|
||||
}
|
||||
|
||||
TensorProto::~TensorProto() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.TensorProto)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void TensorProto::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
tensor_content_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
if (this != internal_default_instance()) delete tensor_shape_;
|
||||
}
|
||||
|
||||
void TensorProto::ArenaDtor(void* object) {
|
||||
TensorProto* _this = reinterpret_cast< TensorProto* >(object);
|
||||
(void)_this;
|
||||
}
|
||||
void TensorProto::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
|
||||
}
|
||||
void TensorProto::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void TensorProto::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.TensorProto)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
float_val_.Clear();
|
||||
double_val_.Clear();
|
||||
int_val_.Clear();
|
||||
string_val_.Clear();
|
||||
scomplex_val_.Clear();
|
||||
int64_val_.Clear();
|
||||
bool_val_.Clear();
|
||||
dcomplex_val_.Clear();
|
||||
half_val_.Clear();
|
||||
tensor_content_.ClearToEmpty();
|
||||
if (GetArenaForAllocation() == nullptr && tensor_shape_ != nullptr) {
|
||||
delete tensor_shape_;
|
||||
}
|
||||
tensor_shape_ = nullptr;
|
||||
::memset(&dtype_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&version_number_) -
|
||||
reinterpret_cast<char*>(&dtype_)) + sizeof(version_number_));
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* TensorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// .opencv_tensorflow.DataType dtype = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
|
||||
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
|
||||
CHK_(ptr);
|
||||
_internal_set_dtype(static_cast<::opencv_tensorflow::DataType>(val));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// .opencv_tensorflow.TensorShapeProto tensor_shape = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
|
||||
ptr = ctx->ParseMessage(_internal_mutable_tensor_shape(), ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 version_number = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
|
||||
version_number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// bytes tensor_content = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
|
||||
auto str = _internal_mutable_tensor_content();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated float float_val = 5 [packed = true];
|
||||
case 5:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedFloatParser(_internal_mutable_float_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 45) {
|
||||
_internal_add_float_val(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr));
|
||||
ptr += sizeof(float);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated double double_val = 6 [packed = true];
|
||||
case 6:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedDoubleParser(_internal_mutable_double_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 49) {
|
||||
_internal_add_double_val(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr));
|
||||
ptr += sizeof(double);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated int32 int_val = 7 [packed = true];
|
||||
case 7:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_int_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 56) {
|
||||
_internal_add_int_val(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated bytes string_val = 8;
|
||||
case 8:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
auto str = _internal_add_string_val();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated float scomplex_val = 9 [packed = true];
|
||||
case 9:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedFloatParser(_internal_mutable_scomplex_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 77) {
|
||||
_internal_add_scomplex_val(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr));
|
||||
ptr += sizeof(float);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated int64 int64_val = 10 [packed = true];
|
||||
case 10:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(_internal_mutable_int64_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 80) {
|
||||
_internal_add_int64_val(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated bool bool_val = 11 [packed = true];
|
||||
case 11:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedBoolParser(_internal_mutable_bool_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 88) {
|
||||
_internal_add_bool_val(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated double dcomplex_val = 12 [packed = true];
|
||||
case 12:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedDoubleParser(_internal_mutable_dcomplex_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 97) {
|
||||
_internal_add_dcomplex_val(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr));
|
||||
ptr += sizeof(double);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated int32 half_val = 13 [packed = true];
|
||||
case 13:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_half_val(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 104) {
|
||||
_internal_add_half_val(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* TensorProto::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.TensorProto)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// .opencv_tensorflow.DataType dtype = 1;
|
||||
if (this->_internal_dtype() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
|
||||
1, this->_internal_dtype(), target);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.TensorShapeProto tensor_shape = 2;
|
||||
if (this->_internal_has_tensor_shape()) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(
|
||||
2, _Internal::tensor_shape(this), target, stream);
|
||||
}
|
||||
|
||||
// int32 version_number = 3;
|
||||
if (this->_internal_version_number() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_version_number(), target);
|
||||
}
|
||||
|
||||
// bytes tensor_content = 4;
|
||||
if (!this->_internal_tensor_content().empty()) {
|
||||
target = stream->WriteBytesMaybeAliased(
|
||||
4, this->_internal_tensor_content(), target);
|
||||
}
|
||||
|
||||
// repeated float float_val = 5 [packed = true];
|
||||
if (this->_internal_float_val_size() > 0) {
|
||||
target = stream->WriteFixedPacked(5, _internal_float_val(), target);
|
||||
}
|
||||
|
||||
// repeated double double_val = 6 [packed = true];
|
||||
if (this->_internal_double_val_size() > 0) {
|
||||
target = stream->WriteFixedPacked(6, _internal_double_val(), target);
|
||||
}
|
||||
|
||||
// repeated int32 int_val = 7 [packed = true];
|
||||
{
|
||||
int byte_size = _int_val_cached_byte_size_.load(std::memory_order_relaxed);
|
||||
if (byte_size > 0) {
|
||||
target = stream->WriteInt32Packed(
|
||||
7, _internal_int_val(), byte_size, target);
|
||||
}
|
||||
}
|
||||
|
||||
// repeated bytes string_val = 8;
|
||||
for (int i = 0, n = this->_internal_string_val_size(); i < n; i++) {
|
||||
const auto& s = this->_internal_string_val(i);
|
||||
target = stream->WriteBytes(8, s, target);
|
||||
}
|
||||
|
||||
// repeated float scomplex_val = 9 [packed = true];
|
||||
if (this->_internal_scomplex_val_size() > 0) {
|
||||
target = stream->WriteFixedPacked(9, _internal_scomplex_val(), target);
|
||||
}
|
||||
|
||||
// repeated int64 int64_val = 10 [packed = true];
|
||||
{
|
||||
int byte_size = _int64_val_cached_byte_size_.load(std::memory_order_relaxed);
|
||||
if (byte_size > 0) {
|
||||
target = stream->WriteInt64Packed(
|
||||
10, _internal_int64_val(), byte_size, target);
|
||||
}
|
||||
}
|
||||
|
||||
// repeated bool bool_val = 11 [packed = true];
|
||||
if (this->_internal_bool_val_size() > 0) {
|
||||
target = stream->WriteFixedPacked(11, _internal_bool_val(), target);
|
||||
}
|
||||
|
||||
// repeated double dcomplex_val = 12 [packed = true];
|
||||
if (this->_internal_dcomplex_val_size() > 0) {
|
||||
target = stream->WriteFixedPacked(12, _internal_dcomplex_val(), target);
|
||||
}
|
||||
|
||||
// repeated int32 half_val = 13 [packed = true];
|
||||
{
|
||||
int byte_size = _half_val_cached_byte_size_.load(std::memory_order_relaxed);
|
||||
if (byte_size > 0) {
|
||||
target = stream->WriteInt32Packed(
|
||||
13, _internal_half_val(), byte_size, target);
|
||||
}
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.TensorProto)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t TensorProto::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.TensorProto)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated float float_val = 5 [packed = true];
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->_internal_float_val_size());
|
||||
size_t data_size = 4UL * count;
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated double double_val = 6 [packed = true];
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->_internal_double_val_size());
|
||||
size_t data_size = 8UL * count;
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated int32 int_val = 7 [packed = true];
|
||||
{
|
||||
size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
Int32Size(this->int_val_);
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
|
||||
_int_val_cached_byte_size_.store(cached_size,
|
||||
std::memory_order_relaxed);
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated bytes string_val = 8;
|
||||
total_size += 1 *
|
||||
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(string_val_.size());
|
||||
for (int i = 0, n = string_val_.size(); i < n; i++) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
|
||||
string_val_.Get(i));
|
||||
}
|
||||
|
||||
// repeated float scomplex_val = 9 [packed = true];
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->_internal_scomplex_val_size());
|
||||
size_t data_size = 4UL * count;
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated int64 int64_val = 10 [packed = true];
|
||||
{
|
||||
size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
Int64Size(this->int64_val_);
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
|
||||
_int64_val_cached_byte_size_.store(cached_size,
|
||||
std::memory_order_relaxed);
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated bool bool_val = 11 [packed = true];
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->_internal_bool_val_size());
|
||||
size_t data_size = 1UL * count;
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated double dcomplex_val = 12 [packed = true];
|
||||
{
|
||||
unsigned int count = static_cast<unsigned int>(this->_internal_dcomplex_val_size());
|
||||
size_t data_size = 8UL * count;
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// repeated int32 half_val = 13 [packed = true];
|
||||
{
|
||||
size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
Int32Size(this->half_val_);
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
|
||||
_half_val_cached_byte_size_.store(cached_size,
|
||||
std::memory_order_relaxed);
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// bytes tensor_content = 4;
|
||||
if (!this->_internal_tensor_content().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
|
||||
this->_internal_tensor_content());
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.TensorShapeProto tensor_shape = 2;
|
||||
if (this->_internal_has_tensor_shape()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
|
||||
*tensor_shape_);
|
||||
}
|
||||
|
||||
// .opencv_tensorflow.DataType dtype = 1;
|
||||
if (this->_internal_dtype() != 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_dtype());
|
||||
}
|
||||
|
||||
// int32 version_number = 3;
|
||||
if (this->_internal_version_number() != 0) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_version_number());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData TensorProto::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
TensorProto::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*TensorProto::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void TensorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<TensorProto *>(to)->MergeFrom(
|
||||
static_cast<const TensorProto &>(from));
|
||||
}
|
||||
|
||||
|
||||
void TensorProto::MergeFrom(const TensorProto& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.TensorProto)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
float_val_.MergeFrom(from.float_val_);
|
||||
double_val_.MergeFrom(from.double_val_);
|
||||
int_val_.MergeFrom(from.int_val_);
|
||||
string_val_.MergeFrom(from.string_val_);
|
||||
scomplex_val_.MergeFrom(from.scomplex_val_);
|
||||
int64_val_.MergeFrom(from.int64_val_);
|
||||
bool_val_.MergeFrom(from.bool_val_);
|
||||
dcomplex_val_.MergeFrom(from.dcomplex_val_);
|
||||
half_val_.MergeFrom(from.half_val_);
|
||||
if (!from._internal_tensor_content().empty()) {
|
||||
_internal_set_tensor_content(from._internal_tensor_content());
|
||||
}
|
||||
if (from._internal_has_tensor_shape()) {
|
||||
_internal_mutable_tensor_shape()->::opencv_tensorflow::TensorShapeProto::MergeFrom(from._internal_tensor_shape());
|
||||
}
|
||||
if (from._internal_dtype() != 0) {
|
||||
_internal_set_dtype(from._internal_dtype());
|
||||
}
|
||||
if (from._internal_version_number() != 0) {
|
||||
_internal_set_version_number(from._internal_version_number());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void TensorProto::CopyFrom(const TensorProto& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.TensorProto)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool TensorProto::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TensorProto::InternalSwap(TensorProto* other) {
|
||||
using std::swap;
|
||||
auto* lhs_arena = GetArenaForAllocation();
|
||||
auto* rhs_arena = other->GetArenaForAllocation();
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
float_val_.InternalSwap(&other->float_val_);
|
||||
double_val_.InternalSwap(&other->double_val_);
|
||||
int_val_.InternalSwap(&other->int_val_);
|
||||
string_val_.InternalSwap(&other->string_val_);
|
||||
scomplex_val_.InternalSwap(&other->scomplex_val_);
|
||||
int64_val_.InternalSwap(&other->int64_val_);
|
||||
bool_val_.InternalSwap(&other->bool_val_);
|
||||
dcomplex_val_.InternalSwap(&other->dcomplex_val_);
|
||||
half_val_.InternalSwap(&other->half_val_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
&tensor_content_, lhs_arena,
|
||||
&other->tensor_content_, rhs_arena
|
||||
);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(TensorProto, version_number_)
|
||||
+ sizeof(TensorProto::version_number_)
|
||||
- PROTOBUF_FIELD_OFFSET(TensorProto, tensor_shape_)>(
|
||||
reinterpret_cast<char*>(&tensor_shape_),
|
||||
reinterpret_cast<char*>(&other->tensor_shape_));
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata TensorProto::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_tensor_2eproto_getter, &descriptor_table_tensor_2eproto_once,
|
||||
file_level_metadata_tensor_2eproto[0]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::TensorProto* Arena::CreateMaybeMessage< ::opencv_tensorflow::TensorProto >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::TensorProto >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,554 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: tensor_shape.proto
|
||||
|
||||
#include "tensor_shape.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace opencv_tensorflow {
|
||||
constexpr TensorShapeProto_Dim::TensorShapeProto_Dim(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, size_(int64_t{0}){}
|
||||
struct TensorShapeProto_DimDefaultTypeInternal {
|
||||
constexpr TensorShapeProto_DimDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~TensorShapeProto_DimDefaultTypeInternal() {}
|
||||
union {
|
||||
TensorShapeProto_Dim _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT TensorShapeProto_DimDefaultTypeInternal _TensorShapeProto_Dim_default_instance_;
|
||||
constexpr TensorShapeProto::TensorShapeProto(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: dim_()
|
||||
, unknown_rank_(false){}
|
||||
struct TensorShapeProtoDefaultTypeInternal {
|
||||
constexpr TensorShapeProtoDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~TensorShapeProtoDefaultTypeInternal() {}
|
||||
union {
|
||||
TensorShapeProto _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT TensorShapeProtoDefaultTypeInternal _TensorShapeProto_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_tensor_5fshape_2eproto[2];
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_tensor_5fshape_2eproto = nullptr;
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_tensor_5fshape_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_tensor_5fshape_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto_Dim, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto_Dim, size_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto_Dim, name_),
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto, dim_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::TensorShapeProto, unknown_rank_),
|
||||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::opencv_tensorflow::TensorShapeProto_Dim)},
|
||||
{ 8, -1, -1, sizeof(::opencv_tensorflow::TensorShapeProto)},
|
||||
};
|
||||
|
||||
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_TensorShapeProto_Dim_default_instance_),
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_TensorShapeProto_default_instance_),
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_tensor_5fshape_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\022tensor_shape.proto\022\021opencv_tensorflow\""
|
||||
"\201\001\n\020TensorShapeProto\0224\n\003dim\030\002 \003(\0132\'.open"
|
||||
"cv_tensorflow.TensorShapeProto.Dim\022\024\n\014un"
|
||||
"known_rank\030\003 \001(\010\032!\n\003Dim\022\014\n\004size\030\001 \001(\003\022\014\n"
|
||||
"\004name\030\002 \001(\tB2\n\030org.tensorflow.frameworkB"
|
||||
"\021TensorShapeProtosP\001\370\001\001b\006proto3"
|
||||
;
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_tensor_5fshape_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensor_5fshape_2eproto = {
|
||||
false, false, 231, descriptor_table_protodef_tensor_5fshape_2eproto, "tensor_shape.proto",
|
||||
&descriptor_table_tensor_5fshape_2eproto_once, nullptr, 0, 2,
|
||||
schemas, file_default_instances, TableStruct_tensor_5fshape_2eproto::offsets,
|
||||
file_level_metadata_tensor_5fshape_2eproto, file_level_enum_descriptors_tensor_5fshape_2eproto, file_level_service_descriptors_tensor_5fshape_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_tensor_5fshape_2eproto_getter() {
|
||||
return &descriptor_table_tensor_5fshape_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_tensor_5fshape_2eproto(&descriptor_table_tensor_5fshape_2eproto);
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TensorShapeProto_Dim::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
TensorShapeProto_Dim::TensorShapeProto_Dim(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
}
|
||||
TensorShapeProto_Dim::TensorShapeProto_Dim(const TensorShapeProto_Dim& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
}
|
||||
size_ = from.size_;
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
}
|
||||
|
||||
inline void TensorShapeProto_Dim::SharedCtor() {
|
||||
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
size_ = int64_t{0};
|
||||
}
|
||||
|
||||
TensorShapeProto_Dim::~TensorShapeProto_Dim() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void TensorShapeProto_Dim::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
|
||||
void TensorShapeProto_Dim::ArenaDtor(void* object) {
|
||||
TensorShapeProto_Dim* _this = reinterpret_cast< TensorShapeProto_Dim* >(object);
|
||||
(void)_this;
|
||||
}
|
||||
void TensorShapeProto_Dim::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
|
||||
}
|
||||
void TensorShapeProto_Dim::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void TensorShapeProto_Dim::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
name_.ClearToEmpty();
|
||||
size_ = int64_t{0};
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* TensorShapeProto_Dim::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// int64 size = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
|
||||
size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// string name = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
|
||||
auto str = _internal_mutable_name();
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "opencv_tensorflow.TensorShapeProto.Dim.name"));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* TensorShapeProto_Dim::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// int64 size = 1;
|
||||
if (this->_internal_size() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_size(), target);
|
||||
}
|
||||
|
||||
// string name = 2;
|
||||
if (!this->_internal_name().empty()) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"opencv_tensorflow.TensorShapeProto.Dim.name");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
2, this->_internal_name(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t TensorShapeProto_Dim::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// string name = 2;
|
||||
if (!this->_internal_name().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_name());
|
||||
}
|
||||
|
||||
// int64 size = 1;
|
||||
if (this->_internal_size() != 0) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_size());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData TensorShapeProto_Dim::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
TensorShapeProto_Dim::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*TensorShapeProto_Dim::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void TensorShapeProto_Dim::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<TensorShapeProto_Dim *>(to)->MergeFrom(
|
||||
static_cast<const TensorShapeProto_Dim &>(from));
|
||||
}
|
||||
|
||||
|
||||
void TensorShapeProto_Dim::MergeFrom(const TensorShapeProto_Dim& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (from._internal_size() != 0) {
|
||||
_internal_set_size(from._internal_size());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void TensorShapeProto_Dim::CopyFrom(const TensorShapeProto_Dim& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool TensorShapeProto_Dim::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TensorShapeProto_Dim::InternalSwap(TensorShapeProto_Dim* other) {
|
||||
using std::swap;
|
||||
auto* lhs_arena = GetArenaForAllocation();
|
||||
auto* rhs_arena = other->GetArenaForAllocation();
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
&name_, lhs_arena,
|
||||
&other->name_, rhs_arena
|
||||
);
|
||||
swap(size_, other->size_);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata TensorShapeProto_Dim::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_tensor_5fshape_2eproto_getter, &descriptor_table_tensor_5fshape_2eproto_once,
|
||||
file_level_metadata_tensor_5fshape_2eproto[0]);
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TensorShapeProto::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
TensorShapeProto::TensorShapeProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
|
||||
dim_(arena) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.TensorShapeProto)
|
||||
}
|
||||
TensorShapeProto::TensorShapeProto(const TensorShapeProto& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(),
|
||||
dim_(from.dim_) {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
unknown_rank_ = from.unknown_rank_;
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.TensorShapeProto)
|
||||
}
|
||||
|
||||
inline void TensorShapeProto::SharedCtor() {
|
||||
unknown_rank_ = false;
|
||||
}
|
||||
|
||||
TensorShapeProto::~TensorShapeProto() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.TensorShapeProto)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void TensorShapeProto::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
}
|
||||
|
||||
void TensorShapeProto::ArenaDtor(void* object) {
|
||||
TensorShapeProto* _this = reinterpret_cast< TensorShapeProto* >(object);
|
||||
(void)_this;
|
||||
}
|
||||
void TensorShapeProto::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
|
||||
}
|
||||
void TensorShapeProto::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void TensorShapeProto::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.TensorShapeProto)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
dim_.Clear();
|
||||
unknown_rank_ = false;
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* TensorShapeProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// repeated .opencv_tensorflow.TensorShapeProto.Dim dim = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(_internal_add_dim(), ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// bool unknown_rank = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
|
||||
unknown_rank_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* TensorShapeProto::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.TensorShapeProto)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .opencv_tensorflow.TensorShapeProto.Dim dim = 2;
|
||||
for (unsigned int i = 0,
|
||||
n = static_cast<unsigned int>(this->_internal_dim_size()); i < n; i++) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(2, this->_internal_dim(i), target, stream);
|
||||
}
|
||||
|
||||
// bool unknown_rank = 3;
|
||||
if (this->_internal_unknown_rank() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_unknown_rank(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.TensorShapeProto)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t TensorShapeProto::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.TensorShapeProto)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .opencv_tensorflow.TensorShapeProto.Dim dim = 2;
|
||||
total_size += 1UL * this->_internal_dim_size();
|
||||
for (const auto& msg : this->dim_) {
|
||||
total_size +=
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
|
||||
}
|
||||
|
||||
// bool unknown_rank = 3;
|
||||
if (this->_internal_unknown_rank() != 0) {
|
||||
total_size += 1 + 1;
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData TensorShapeProto::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
TensorShapeProto::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*TensorShapeProto::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void TensorShapeProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<TensorShapeProto *>(to)->MergeFrom(
|
||||
static_cast<const TensorShapeProto &>(from));
|
||||
}
|
||||
|
||||
|
||||
void TensorShapeProto::MergeFrom(const TensorShapeProto& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.TensorShapeProto)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
dim_.MergeFrom(from.dim_);
|
||||
if (from._internal_unknown_rank() != 0) {
|
||||
_internal_set_unknown_rank(from._internal_unknown_rank());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void TensorShapeProto::CopyFrom(const TensorShapeProto& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.TensorShapeProto)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool TensorShapeProto::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TensorShapeProto::InternalSwap(TensorShapeProto* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
dim_.InternalSwap(&other->dim_);
|
||||
swap(unknown_rank_, other->unknown_rank_);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata TensorShapeProto::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_tensor_5fshape_2eproto_getter, &descriptor_table_tensor_5fshape_2eproto_once,
|
||||
file_level_metadata_tensor_5fshape_2eproto[1]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::TensorShapeProto_Dim* Arena::CreateMaybeMessage< ::opencv_tensorflow::TensorShapeProto_Dim >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::TensorShapeProto_Dim >(arena);
|
||||
}
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::TensorShapeProto* Arena::CreateMaybeMessage< ::opencv_tensorflow::TensorShapeProto >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::TensorShapeProto >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
@@ -0,0 +1,559 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: tensor_shape.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_tensor_5fshape_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_tensor_5fshape_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3019000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_table_driven.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_tensor_5fshape_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_tensor_5fshape_2eproto {
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensor_5fshape_2eproto;
|
||||
namespace opencv_tensorflow {
|
||||
class TensorShapeProto;
|
||||
struct TensorShapeProtoDefaultTypeInternal;
|
||||
extern TensorShapeProtoDefaultTypeInternal _TensorShapeProto_default_instance_;
|
||||
class TensorShapeProto_Dim;
|
||||
struct TensorShapeProto_DimDefaultTypeInternal;
|
||||
extern TensorShapeProto_DimDefaultTypeInternal _TensorShapeProto_Dim_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::opencv_tensorflow::TensorShapeProto* Arena::CreateMaybeMessage<::opencv_tensorflow::TensorShapeProto>(Arena*);
|
||||
template<> ::opencv_tensorflow::TensorShapeProto_Dim* Arena::CreateMaybeMessage<::opencv_tensorflow::TensorShapeProto_Dim>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TensorShapeProto_Dim final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:opencv_tensorflow.TensorShapeProto.Dim) */ {
|
||||
public:
|
||||
inline TensorShapeProto_Dim() : TensorShapeProto_Dim(nullptr) {}
|
||||
~TensorShapeProto_Dim() override;
|
||||
explicit constexpr TensorShapeProto_Dim(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
TensorShapeProto_Dim(const TensorShapeProto_Dim& from);
|
||||
TensorShapeProto_Dim(TensorShapeProto_Dim&& from) noexcept
|
||||
: TensorShapeProto_Dim() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline TensorShapeProto_Dim& operator=(const TensorShapeProto_Dim& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline TensorShapeProto_Dim& operator=(TensorShapeProto_Dim&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const TensorShapeProto_Dim& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const TensorShapeProto_Dim* internal_default_instance() {
|
||||
return reinterpret_cast<const TensorShapeProto_Dim*>(
|
||||
&_TensorShapeProto_Dim_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(TensorShapeProto_Dim& a, TensorShapeProto_Dim& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(TensorShapeProto_Dim* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(TensorShapeProto_Dim* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
TensorShapeProto_Dim* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<TensorShapeProto_Dim>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const TensorShapeProto_Dim& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const TensorShapeProto_Dim& from);
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(TensorShapeProto_Dim* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "opencv_tensorflow.TensorShapeProto.Dim";
|
||||
}
|
||||
protected:
|
||||
explicit TensorShapeProto_Dim(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
private:
|
||||
static void ArenaDtor(void* object);
|
||||
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kNameFieldNumber = 2,
|
||||
kSizeFieldNumber = 1,
|
||||
};
|
||||
// string name = 2;
|
||||
void clear_name();
|
||||
const std::string& name() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_name(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_name();
|
||||
PROTOBUF_NODISCARD std::string* release_name();
|
||||
void set_allocated_name(std::string* name);
|
||||
private:
|
||||
const std::string& _internal_name() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
|
||||
std::string* _internal_mutable_name();
|
||||
public:
|
||||
|
||||
// int64 size = 1;
|
||||
void clear_size();
|
||||
int64_t size() const;
|
||||
void set_size(int64_t value);
|
||||
private:
|
||||
int64_t _internal_size() const;
|
||||
void _internal_set_size(int64_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:opencv_tensorflow.TensorShapeProto.Dim)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
|
||||
int64_t size_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_tensor_5fshape_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class TensorShapeProto final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:opencv_tensorflow.TensorShapeProto) */ {
|
||||
public:
|
||||
inline TensorShapeProto() : TensorShapeProto(nullptr) {}
|
||||
~TensorShapeProto() override;
|
||||
explicit constexpr TensorShapeProto(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
TensorShapeProto(const TensorShapeProto& from);
|
||||
TensorShapeProto(TensorShapeProto&& from) noexcept
|
||||
: TensorShapeProto() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline TensorShapeProto& operator=(const TensorShapeProto& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline TensorShapeProto& operator=(TensorShapeProto&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const TensorShapeProto& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const TensorShapeProto* internal_default_instance() {
|
||||
return reinterpret_cast<const TensorShapeProto*>(
|
||||
&_TensorShapeProto_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
1;
|
||||
|
||||
friend void swap(TensorShapeProto& a, TensorShapeProto& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(TensorShapeProto* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(TensorShapeProto* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
TensorShapeProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<TensorShapeProto>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const TensorShapeProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const TensorShapeProto& from);
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(TensorShapeProto* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "opencv_tensorflow.TensorShapeProto";
|
||||
}
|
||||
protected:
|
||||
explicit TensorShapeProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
private:
|
||||
static void ArenaDtor(void* object);
|
||||
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
typedef TensorShapeProto_Dim Dim;
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kDimFieldNumber = 2,
|
||||
kUnknownRankFieldNumber = 3,
|
||||
};
|
||||
// repeated .opencv_tensorflow.TensorShapeProto.Dim dim = 2;
|
||||
int dim_size() const;
|
||||
private:
|
||||
int _internal_dim_size() const;
|
||||
public:
|
||||
void clear_dim();
|
||||
::opencv_tensorflow::TensorShapeProto_Dim* mutable_dim(int index);
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::opencv_tensorflow::TensorShapeProto_Dim >*
|
||||
mutable_dim();
|
||||
private:
|
||||
const ::opencv_tensorflow::TensorShapeProto_Dim& _internal_dim(int index) const;
|
||||
::opencv_tensorflow::TensorShapeProto_Dim* _internal_add_dim();
|
||||
public:
|
||||
const ::opencv_tensorflow::TensorShapeProto_Dim& dim(int index) const;
|
||||
::opencv_tensorflow::TensorShapeProto_Dim* add_dim();
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::opencv_tensorflow::TensorShapeProto_Dim >&
|
||||
dim() const;
|
||||
|
||||
// bool unknown_rank = 3;
|
||||
void clear_unknown_rank();
|
||||
bool unknown_rank() const;
|
||||
void set_unknown_rank(bool value);
|
||||
private:
|
||||
bool _internal_unknown_rank() const;
|
||||
void _internal_set_unknown_rank(bool value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:opencv_tensorflow.TensorShapeProto)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::opencv_tensorflow::TensorShapeProto_Dim > dim_;
|
||||
bool unknown_rank_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_tensor_5fshape_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// TensorShapeProto_Dim
|
||||
|
||||
// int64 size = 1;
|
||||
inline void TensorShapeProto_Dim::clear_size() {
|
||||
size_ = int64_t{0};
|
||||
}
|
||||
inline int64_t TensorShapeProto_Dim::_internal_size() const {
|
||||
return size_;
|
||||
}
|
||||
inline int64_t TensorShapeProto_Dim::size() const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.TensorShapeProto.Dim.size)
|
||||
return _internal_size();
|
||||
}
|
||||
inline void TensorShapeProto_Dim::_internal_set_size(int64_t value) {
|
||||
|
||||
size_ = value;
|
||||
}
|
||||
inline void TensorShapeProto_Dim::set_size(int64_t value) {
|
||||
_internal_set_size(value);
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.TensorShapeProto.Dim.size)
|
||||
}
|
||||
|
||||
// string name = 2;
|
||||
inline void TensorShapeProto_Dim::clear_name() {
|
||||
name_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& TensorShapeProto_Dim::name() const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.TensorShapeProto.Dim.name)
|
||||
return _internal_name();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void TensorShapeProto_Dim::set_name(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.TensorShapeProto.Dim.name)
|
||||
}
|
||||
inline std::string* TensorShapeProto_Dim::mutable_name() {
|
||||
std::string* _s = _internal_mutable_name();
|
||||
// @@protoc_insertion_point(field_mutable:opencv_tensorflow.TensorShapeProto.Dim.name)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& TensorShapeProto_Dim::_internal_name() const {
|
||||
return name_.Get();
|
||||
}
|
||||
inline void TensorShapeProto_Dim::_internal_set_name(const std::string& value) {
|
||||
|
||||
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* TensorShapeProto_Dim::_internal_mutable_name() {
|
||||
|
||||
return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* TensorShapeProto_Dim::release_name() {
|
||||
// @@protoc_insertion_point(field_release:opencv_tensorflow.TensorShapeProto.Dim.name)
|
||||
return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
|
||||
}
|
||||
inline void TensorShapeProto_Dim::set_allocated_name(std::string* name) {
|
||||
if (name != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
|
||||
GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
|
||||
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:opencv_tensorflow.TensorShapeProto.Dim.name)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// TensorShapeProto
|
||||
|
||||
// repeated .opencv_tensorflow.TensorShapeProto.Dim dim = 2;
|
||||
inline int TensorShapeProto::_internal_dim_size() const {
|
||||
return dim_.size();
|
||||
}
|
||||
inline int TensorShapeProto::dim_size() const {
|
||||
return _internal_dim_size();
|
||||
}
|
||||
inline void TensorShapeProto::clear_dim() {
|
||||
dim_.Clear();
|
||||
}
|
||||
inline ::opencv_tensorflow::TensorShapeProto_Dim* TensorShapeProto::mutable_dim(int index) {
|
||||
// @@protoc_insertion_point(field_mutable:opencv_tensorflow.TensorShapeProto.dim)
|
||||
return dim_.Mutable(index);
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::opencv_tensorflow::TensorShapeProto_Dim >*
|
||||
TensorShapeProto::mutable_dim() {
|
||||
// @@protoc_insertion_point(field_mutable_list:opencv_tensorflow.TensorShapeProto.dim)
|
||||
return &dim_;
|
||||
}
|
||||
inline const ::opencv_tensorflow::TensorShapeProto_Dim& TensorShapeProto::_internal_dim(int index) const {
|
||||
return dim_.Get(index);
|
||||
}
|
||||
inline const ::opencv_tensorflow::TensorShapeProto_Dim& TensorShapeProto::dim(int index) const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.TensorShapeProto.dim)
|
||||
return _internal_dim(index);
|
||||
}
|
||||
inline ::opencv_tensorflow::TensorShapeProto_Dim* TensorShapeProto::_internal_add_dim() {
|
||||
return dim_.Add();
|
||||
}
|
||||
inline ::opencv_tensorflow::TensorShapeProto_Dim* TensorShapeProto::add_dim() {
|
||||
::opencv_tensorflow::TensorShapeProto_Dim* _add = _internal_add_dim();
|
||||
// @@protoc_insertion_point(field_add:opencv_tensorflow.TensorShapeProto.dim)
|
||||
return _add;
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::opencv_tensorflow::TensorShapeProto_Dim >&
|
||||
TensorShapeProto::dim() const {
|
||||
// @@protoc_insertion_point(field_list:opencv_tensorflow.TensorShapeProto.dim)
|
||||
return dim_;
|
||||
}
|
||||
|
||||
// bool unknown_rank = 3;
|
||||
inline void TensorShapeProto::clear_unknown_rank() {
|
||||
unknown_rank_ = false;
|
||||
}
|
||||
inline bool TensorShapeProto::_internal_unknown_rank() const {
|
||||
return unknown_rank_;
|
||||
}
|
||||
inline bool TensorShapeProto::unknown_rank() const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.TensorShapeProto.unknown_rank)
|
||||
return _internal_unknown_rank();
|
||||
}
|
||||
inline void TensorShapeProto::_internal_set_unknown_rank(bool value) {
|
||||
|
||||
unknown_rank_ = value;
|
||||
}
|
||||
inline void TensorShapeProto::set_unknown_rank(bool value) {
|
||||
_internal_set_unknown_rank(value);
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.TensorShapeProto.unknown_rank)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace opencv_tensorflow
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensor_5fshape_2eproto
|
||||
@@ -0,0 +1,120 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: types.proto
|
||||
|
||||
#include "types.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace opencv_tensorflow {
|
||||
} // namespace opencv_tensorflow
|
||||
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_types_2eproto[1];
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_types_2eproto = nullptr;
|
||||
const uint32_t TableStruct_types_2eproto::offsets[1] = {};
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema* schemas = nullptr;
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::Message* const* file_default_instances = nullptr;
|
||||
|
||||
const char descriptor_table_protodef_types_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\013types.proto\022\021opencv_tensorflow*\234\005\n\010Dat"
|
||||
"aType\022\016\n\nDT_INVALID\020\000\022\014\n\010DT_FLOAT\020\001\022\r\n\tD"
|
||||
"T_DOUBLE\020\002\022\014\n\010DT_INT32\020\003\022\014\n\010DT_UINT8\020\004\022\014"
|
||||
"\n\010DT_INT16\020\005\022\013\n\007DT_INT8\020\006\022\r\n\tDT_STRING\020\007"
|
||||
"\022\020\n\014DT_COMPLEX64\020\010\022\014\n\010DT_INT64\020\t\022\013\n\007DT_B"
|
||||
"OOL\020\n\022\014\n\010DT_QINT8\020\013\022\r\n\tDT_QUINT8\020\014\022\r\n\tDT"
|
||||
"_QINT32\020\r\022\017\n\013DT_BFLOAT16\020\016\022\r\n\tDT_QINT16\020"
|
||||
"\017\022\016\n\nDT_QUINT16\020\020\022\r\n\tDT_UINT16\020\021\022\021\n\rDT_C"
|
||||
"OMPLEX128\020\022\022\013\n\007DT_HALF\020\023\022\020\n\014DT_FLOAT_REF"
|
||||
"\020e\022\021\n\rDT_DOUBLE_REF\020f\022\020\n\014DT_INT32_REF\020g\022"
|
||||
"\020\n\014DT_UINT8_REF\020h\022\020\n\014DT_INT16_REF\020i\022\017\n\013D"
|
||||
"T_INT8_REF\020j\022\021\n\rDT_STRING_REF\020k\022\024\n\020DT_CO"
|
||||
"MPLEX64_REF\020l\022\020\n\014DT_INT64_REF\020m\022\017\n\013DT_BO"
|
||||
"OL_REF\020n\022\020\n\014DT_QINT8_REF\020o\022\021\n\rDT_QUINT8_"
|
||||
"REF\020p\022\021\n\rDT_QINT32_REF\020q\022\023\n\017DT_BFLOAT16_"
|
||||
"REF\020r\022\021\n\rDT_QINT16_REF\020s\022\022\n\016DT_QUINT16_R"
|
||||
"EF\020t\022\021\n\rDT_UINT16_REF\020u\022\025\n\021DT_COMPLEX128"
|
||||
"_REF\020v\022\017\n\013DT_HALF_REF\020wB,\n\030org.tensorflo"
|
||||
"w.frameworkB\013TypesProtosP\001\370\001\001b\006proto3"
|
||||
;
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_types_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_types_2eproto = {
|
||||
false, false, 757, descriptor_table_protodef_types_2eproto, "types.proto",
|
||||
&descriptor_table_types_2eproto_once, nullptr, 0, 0,
|
||||
schemas, file_default_instances, TableStruct_types_2eproto::offsets,
|
||||
nullptr, file_level_enum_descriptors_types_2eproto, file_level_service_descriptors_types_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_types_2eproto_getter() {
|
||||
return &descriptor_table_types_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_types_2eproto(&descriptor_table_types_2eproto);
|
||||
namespace opencv_tensorflow {
|
||||
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* DataType_descriptor() {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_types_2eproto);
|
||||
return file_level_enum_descriptors_types_2eproto[0];
|
||||
}
|
||||
bool DataType_IsValid(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
case 106:
|
||||
case 107:
|
||||
case 108:
|
||||
case 109:
|
||||
case 110:
|
||||
case 111:
|
||||
case 112:
|
||||
case 113:
|
||||
case 114:
|
||||
case 115:
|
||||
case 116:
|
||||
case 117:
|
||||
case 118:
|
||||
case 119:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
@@ -0,0 +1,154 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: types.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_types_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_types_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3019000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_table_driven.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/generated_enum_reflection.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_types_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_types_2eproto {
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_types_2eproto;
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
enum DataType : int {
|
||||
DT_INVALID = 0,
|
||||
DT_FLOAT = 1,
|
||||
DT_DOUBLE = 2,
|
||||
DT_INT32 = 3,
|
||||
DT_UINT8 = 4,
|
||||
DT_INT16 = 5,
|
||||
DT_INT8 = 6,
|
||||
DT_STRING = 7,
|
||||
DT_COMPLEX64 = 8,
|
||||
DT_INT64 = 9,
|
||||
DT_BOOL = 10,
|
||||
DT_QINT8 = 11,
|
||||
DT_QUINT8 = 12,
|
||||
DT_QINT32 = 13,
|
||||
DT_BFLOAT16 = 14,
|
||||
DT_QINT16 = 15,
|
||||
DT_QUINT16 = 16,
|
||||
DT_UINT16 = 17,
|
||||
DT_COMPLEX128 = 18,
|
||||
DT_HALF = 19,
|
||||
DT_FLOAT_REF = 101,
|
||||
DT_DOUBLE_REF = 102,
|
||||
DT_INT32_REF = 103,
|
||||
DT_UINT8_REF = 104,
|
||||
DT_INT16_REF = 105,
|
||||
DT_INT8_REF = 106,
|
||||
DT_STRING_REF = 107,
|
||||
DT_COMPLEX64_REF = 108,
|
||||
DT_INT64_REF = 109,
|
||||
DT_BOOL_REF = 110,
|
||||
DT_QINT8_REF = 111,
|
||||
DT_QUINT8_REF = 112,
|
||||
DT_QINT32_REF = 113,
|
||||
DT_BFLOAT16_REF = 114,
|
||||
DT_QINT16_REF = 115,
|
||||
DT_QUINT16_REF = 116,
|
||||
DT_UINT16_REF = 117,
|
||||
DT_COMPLEX128_REF = 118,
|
||||
DT_HALF_REF = 119,
|
||||
DataType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
|
||||
DataType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
|
||||
};
|
||||
bool DataType_IsValid(int value);
|
||||
constexpr DataType DataType_MIN = DT_INVALID;
|
||||
constexpr DataType DataType_MAX = DT_HALF_REF;
|
||||
constexpr int DataType_ARRAYSIZE = DataType_MAX + 1;
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* DataType_descriptor();
|
||||
template<typename T>
|
||||
inline const std::string& DataType_Name(T enum_t_value) {
|
||||
static_assert(::std::is_same<T, DataType>::value ||
|
||||
::std::is_integral<T>::value,
|
||||
"Incorrect type passed to function DataType_Name.");
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum(
|
||||
DataType_descriptor(), enum_t_value);
|
||||
}
|
||||
inline bool DataType_Parse(
|
||||
::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DataType* value) {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum<DataType>(
|
||||
DataType_descriptor(), name, value);
|
||||
}
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace opencv_tensorflow
|
||||
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
|
||||
template <> struct is_proto_enum< ::opencv_tensorflow::DataType> : ::std::true_type {};
|
||||
template <>
|
||||
inline const EnumDescriptor* GetEnumDescriptor< ::opencv_tensorflow::DataType>() {
|
||||
return ::opencv_tensorflow::DataType_descriptor();
|
||||
}
|
||||
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_types_2eproto
|
||||
@@ -0,0 +1,342 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: versions.proto
|
||||
|
||||
#include "versions.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace opencv_tensorflow {
|
||||
constexpr VersionDef::VersionDef(
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
|
||||
: bad_consumers_()
|
||||
, _bad_consumers_cached_byte_size_(0)
|
||||
, producer_(0)
|
||||
, min_consumer_(0){}
|
||||
struct VersionDefDefaultTypeInternal {
|
||||
constexpr VersionDefDefaultTypeInternal()
|
||||
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
|
||||
~VersionDefDefaultTypeInternal() {}
|
||||
union {
|
||||
VersionDef _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT VersionDefDefaultTypeInternal _VersionDef_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_versions_2eproto[1];
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_versions_2eproto = nullptr;
|
||||
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_versions_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_versions_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::VersionDef, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::VersionDef, producer_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::VersionDef, min_consumer_),
|
||||
PROTOBUF_FIELD_OFFSET(::opencv_tensorflow::VersionDef, bad_consumers_),
|
||||
};
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::opencv_tensorflow::VersionDef)},
|
||||
};
|
||||
|
||||
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
|
||||
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::opencv_tensorflow::_VersionDef_default_instance_),
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_versions_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\016versions.proto\022\021opencv_tensorflow\"K\n\nV"
|
||||
"ersionDef\022\020\n\010producer\030\001 \001(\005\022\024\n\014min_consu"
|
||||
"mer\030\002 \001(\005\022\025\n\rbad_consumers\030\003 \003(\005B/\n\030org."
|
||||
"tensorflow.frameworkB\016VersionsProtosP\001\370\001"
|
||||
"\001b\006proto3"
|
||||
;
|
||||
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_versions_2eproto_once;
|
||||
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_versions_2eproto = {
|
||||
false, false, 169, descriptor_table_protodef_versions_2eproto, "versions.proto",
|
||||
&descriptor_table_versions_2eproto_once, nullptr, 0, 1,
|
||||
schemas, file_default_instances, TableStruct_versions_2eproto::offsets,
|
||||
file_level_metadata_versions_2eproto, file_level_enum_descriptors_versions_2eproto, file_level_service_descriptors_versions_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_versions_2eproto_getter() {
|
||||
return &descriptor_table_versions_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_versions_2eproto(&descriptor_table_versions_2eproto);
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class VersionDef::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
VersionDef::VersionDef(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
|
||||
bad_consumers_(arena) {
|
||||
SharedCtor();
|
||||
if (!is_message_owned) {
|
||||
RegisterArenaDtor(arena);
|
||||
}
|
||||
// @@protoc_insertion_point(arena_constructor:opencv_tensorflow.VersionDef)
|
||||
}
|
||||
VersionDef::VersionDef(const VersionDef& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(),
|
||||
bad_consumers_(from.bad_consumers_) {
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
::memcpy(&producer_, &from.producer_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&min_consumer_) -
|
||||
reinterpret_cast<char*>(&producer_)) + sizeof(min_consumer_));
|
||||
// @@protoc_insertion_point(copy_constructor:opencv_tensorflow.VersionDef)
|
||||
}
|
||||
|
||||
inline void VersionDef::SharedCtor() {
|
||||
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&producer_) - reinterpret_cast<char*>(this)),
|
||||
0, static_cast<size_t>(reinterpret_cast<char*>(&min_consumer_) -
|
||||
reinterpret_cast<char*>(&producer_)) + sizeof(min_consumer_));
|
||||
}
|
||||
|
||||
VersionDef::~VersionDef() {
|
||||
// @@protoc_insertion_point(destructor:opencv_tensorflow.VersionDef)
|
||||
if (GetArenaForAllocation() != nullptr) return;
|
||||
SharedDtor();
|
||||
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
inline void VersionDef::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
}
|
||||
|
||||
void VersionDef::ArenaDtor(void* object) {
|
||||
VersionDef* _this = reinterpret_cast< VersionDef* >(object);
|
||||
(void)_this;
|
||||
}
|
||||
void VersionDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
|
||||
}
|
||||
void VersionDef::SetCachedSize(int size) const {
|
||||
_cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void VersionDef::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.VersionDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
bad_consumers_.Clear();
|
||||
::memset(&producer_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&min_consumer_) -
|
||||
reinterpret_cast<char*>(&producer_)) + sizeof(min_consumer_));
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* VersionDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// int32 producer = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
|
||||
producer_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 min_consumer = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
|
||||
min_consumer_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated int32 bad_consumers = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
|
||||
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_bad_consumers(), ptr, ctx);
|
||||
CHK_(ptr);
|
||||
} else if (static_cast<uint8_t>(tag) == 24) {
|
||||
_internal_add_bad_consumers(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* VersionDef::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.VersionDef)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// int32 producer = 1;
|
||||
if (this->_internal_producer() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_producer(), target);
|
||||
}
|
||||
|
||||
// int32 min_consumer = 2;
|
||||
if (this->_internal_min_consumer() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_min_consumer(), target);
|
||||
}
|
||||
|
||||
// repeated int32 bad_consumers = 3;
|
||||
{
|
||||
int byte_size = _bad_consumers_cached_byte_size_.load(std::memory_order_relaxed);
|
||||
if (byte_size > 0) {
|
||||
target = stream->WriteInt32Packed(
|
||||
3, _internal_bad_consumers(), byte_size, target);
|
||||
}
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.VersionDef)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t VersionDef::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.VersionDef)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated int32 bad_consumers = 3;
|
||||
{
|
||||
size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
Int32Size(this->bad_consumers_);
|
||||
if (data_size > 0) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
|
||||
static_cast<int32_t>(data_size));
|
||||
}
|
||||
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
|
||||
_bad_consumers_cached_byte_size_.store(cached_size,
|
||||
std::memory_order_relaxed);
|
||||
total_size += data_size;
|
||||
}
|
||||
|
||||
// int32 producer = 1;
|
||||
if (this->_internal_producer() != 0) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_producer());
|
||||
}
|
||||
|
||||
// int32 min_consumer = 2;
|
||||
if (this->_internal_min_consumer() != 0) {
|
||||
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_min_consumer());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VersionDef::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
|
||||
VersionDef::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VersionDef::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void VersionDef::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<VersionDef *>(to)->MergeFrom(
|
||||
static_cast<const VersionDef &>(from));
|
||||
}
|
||||
|
||||
|
||||
void VersionDef::MergeFrom(const VersionDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.VersionDef)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
bad_consumers_.MergeFrom(from.bad_consumers_);
|
||||
if (from._internal_producer() != 0) {
|
||||
_internal_set_producer(from._internal_producer());
|
||||
}
|
||||
if (from._internal_min_consumer() != 0) {
|
||||
_internal_set_min_consumer(from._internal_min_consumer());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void VersionDef::CopyFrom(const VersionDef& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.VersionDef)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool VersionDef::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void VersionDef::InternalSwap(VersionDef* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
bad_consumers_.InternalSwap(&other->bad_consumers_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(VersionDef, min_consumer_)
|
||||
+ sizeof(VersionDef::min_consumer_)
|
||||
- PROTOBUF_FIELD_OFFSET(VersionDef, producer_)>(
|
||||
reinterpret_cast<char*>(&producer_),
|
||||
reinterpret_cast<char*>(&other->producer_));
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata VersionDef::GetMetadata() const {
|
||||
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
|
||||
&descriptor_table_versions_2eproto_getter, &descriptor_table_versions_2eproto_once,
|
||||
file_level_metadata_versions_2eproto[0]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::opencv_tensorflow::VersionDef* Arena::CreateMaybeMessage< ::opencv_tensorflow::VersionDef >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::opencv_tensorflow::VersionDef >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
@@ -0,0 +1,357 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: versions.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_versions_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_versions_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3019000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_table_driven.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_versions_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_versions_2eproto {
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_versions_2eproto;
|
||||
namespace opencv_tensorflow {
|
||||
class VersionDef;
|
||||
struct VersionDefDefaultTypeInternal;
|
||||
extern VersionDefDefaultTypeInternal _VersionDef_default_instance_;
|
||||
} // namespace opencv_tensorflow
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::opencv_tensorflow::VersionDef* Arena::CreateMaybeMessage<::opencv_tensorflow::VersionDef>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace opencv_tensorflow {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class VersionDef final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:opencv_tensorflow.VersionDef) */ {
|
||||
public:
|
||||
inline VersionDef() : VersionDef(nullptr) {}
|
||||
~VersionDef() override;
|
||||
explicit constexpr VersionDef(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
VersionDef(const VersionDef& from);
|
||||
VersionDef(VersionDef&& from) noexcept
|
||||
: VersionDef() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline VersionDef& operator=(const VersionDef& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline VersionDef& operator=(VersionDef&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const VersionDef& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const VersionDef* internal_default_instance() {
|
||||
return reinterpret_cast<const VersionDef*>(
|
||||
&_VersionDef_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(VersionDef& a, VersionDef& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(VersionDef* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(VersionDef* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
VersionDef* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<VersionDef>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const VersionDef& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const VersionDef& from);
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor();
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(VersionDef* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "opencv_tensorflow.VersionDef";
|
||||
}
|
||||
protected:
|
||||
explicit VersionDef(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
private:
|
||||
static void ArenaDtor(void* object);
|
||||
inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kBadConsumersFieldNumber = 3,
|
||||
kProducerFieldNumber = 1,
|
||||
kMinConsumerFieldNumber = 2,
|
||||
};
|
||||
// repeated int32 bad_consumers = 3;
|
||||
int bad_consumers_size() const;
|
||||
private:
|
||||
int _internal_bad_consumers_size() const;
|
||||
public:
|
||||
void clear_bad_consumers();
|
||||
private:
|
||||
int32_t _internal_bad_consumers(int index) const;
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
|
||||
_internal_bad_consumers() const;
|
||||
void _internal_add_bad_consumers(int32_t value);
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
|
||||
_internal_mutable_bad_consumers();
|
||||
public:
|
||||
int32_t bad_consumers(int index) const;
|
||||
void set_bad_consumers(int index, int32_t value);
|
||||
void add_bad_consumers(int32_t value);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
|
||||
bad_consumers() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
|
||||
mutable_bad_consumers();
|
||||
|
||||
// int32 producer = 1;
|
||||
void clear_producer();
|
||||
int32_t producer() const;
|
||||
void set_producer(int32_t value);
|
||||
private:
|
||||
int32_t _internal_producer() const;
|
||||
void _internal_set_producer(int32_t value);
|
||||
public:
|
||||
|
||||
// int32 min_consumer = 2;
|
||||
void clear_min_consumer();
|
||||
int32_t min_consumer() const;
|
||||
void set_min_consumer(int32_t value);
|
||||
private:
|
||||
int32_t _internal_min_consumer() const;
|
||||
void _internal_set_min_consumer(int32_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:opencv_tensorflow.VersionDef)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > bad_consumers_;
|
||||
mutable std::atomic<int> _bad_consumers_cached_byte_size_;
|
||||
int32_t producer_;
|
||||
int32_t min_consumer_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_versions_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// VersionDef
|
||||
|
||||
// int32 producer = 1;
|
||||
inline void VersionDef::clear_producer() {
|
||||
producer_ = 0;
|
||||
}
|
||||
inline int32_t VersionDef::_internal_producer() const {
|
||||
return producer_;
|
||||
}
|
||||
inline int32_t VersionDef::producer() const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.VersionDef.producer)
|
||||
return _internal_producer();
|
||||
}
|
||||
inline void VersionDef::_internal_set_producer(int32_t value) {
|
||||
|
||||
producer_ = value;
|
||||
}
|
||||
inline void VersionDef::set_producer(int32_t value) {
|
||||
_internal_set_producer(value);
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.VersionDef.producer)
|
||||
}
|
||||
|
||||
// int32 min_consumer = 2;
|
||||
inline void VersionDef::clear_min_consumer() {
|
||||
min_consumer_ = 0;
|
||||
}
|
||||
inline int32_t VersionDef::_internal_min_consumer() const {
|
||||
return min_consumer_;
|
||||
}
|
||||
inline int32_t VersionDef::min_consumer() const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.VersionDef.min_consumer)
|
||||
return _internal_min_consumer();
|
||||
}
|
||||
inline void VersionDef::_internal_set_min_consumer(int32_t value) {
|
||||
|
||||
min_consumer_ = value;
|
||||
}
|
||||
inline void VersionDef::set_min_consumer(int32_t value) {
|
||||
_internal_set_min_consumer(value);
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.VersionDef.min_consumer)
|
||||
}
|
||||
|
||||
// repeated int32 bad_consumers = 3;
|
||||
inline int VersionDef::_internal_bad_consumers_size() const {
|
||||
return bad_consumers_.size();
|
||||
}
|
||||
inline int VersionDef::bad_consumers_size() const {
|
||||
return _internal_bad_consumers_size();
|
||||
}
|
||||
inline void VersionDef::clear_bad_consumers() {
|
||||
bad_consumers_.Clear();
|
||||
}
|
||||
inline int32_t VersionDef::_internal_bad_consumers(int index) const {
|
||||
return bad_consumers_.Get(index);
|
||||
}
|
||||
inline int32_t VersionDef::bad_consumers(int index) const {
|
||||
// @@protoc_insertion_point(field_get:opencv_tensorflow.VersionDef.bad_consumers)
|
||||
return _internal_bad_consumers(index);
|
||||
}
|
||||
inline void VersionDef::set_bad_consumers(int index, int32_t value) {
|
||||
bad_consumers_.Set(index, value);
|
||||
// @@protoc_insertion_point(field_set:opencv_tensorflow.VersionDef.bad_consumers)
|
||||
}
|
||||
inline void VersionDef::_internal_add_bad_consumers(int32_t value) {
|
||||
bad_consumers_.Add(value);
|
||||
}
|
||||
inline void VersionDef::add_bad_consumers(int32_t value) {
|
||||
_internal_add_bad_consumers(value);
|
||||
// @@protoc_insertion_point(field_add:opencv_tensorflow.VersionDef.bad_consumers)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
|
||||
VersionDef::_internal_bad_consumers() const {
|
||||
return bad_consumers_;
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
|
||||
VersionDef::bad_consumers() const {
|
||||
// @@protoc_insertion_point(field_list:opencv_tensorflow.VersionDef.bad_consumers)
|
||||
return _internal_bad_consumers();
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
|
||||
VersionDef::_internal_mutable_bad_consumers() {
|
||||
return &bad_consumers_;
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
|
||||
VersionDef::mutable_bad_consumers() {
|
||||
// @@protoc_insertion_point(field_mutable_list:opencv_tensorflow.VersionDef.bad_consumers)
|
||||
return _internal_mutable_bad_consumers();
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace opencv_tensorflow
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_versions_2eproto
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user