1 /** 2 * Copyright 2020 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef DATASET_MDTODAPI_H_ 17 #define DATASET_MDTODAPI_H_ 18 19 #include <stdint.h> 20 #include <sys/types.h> 21 22 namespace mindspore { 23 class MDToDApi; 24 25 typedef struct MDToDBuff { 26 void *Buff; 27 size_t DataSize; 28 size_t TensorSize[4]; 29 size_t MaxBuffSize; 30 } MDToDBuff_t; 31 32 typedef struct MDToDConf { 33 const char *pFolderPath; 34 const char *pSchemFile; 35 const char *pStoragePath; 36 MDToDBuff_t columnsToReadBuff; 37 float MEAN[3]; 38 float STD[3]; 39 int ResizeSizeWH[2]; 40 int fixOrientation; 41 int CropSizeWH[2]; 42 int64_t fileid; // -1 All files, otherwise get a single specific file 43 } MDToDConf_t; 44 45 typedef struct MDToDResult { 46 int64_t fileid; 47 int32_t isForTrain; 48 int32_t noOfFaces; 49 int32_t orientation; 50 MDToDBuff_t fileNameBuff; 51 MDToDBuff_t labelBuff; 52 MDToDBuff_t imageBuff; 53 MDToDBuff_t embeddingBuff; 54 MDToDBuff_t boundingBoxesBuff; 55 MDToDBuff_t confidencesBuff; 56 MDToDBuff_t landmarksBuff; 57 MDToDBuff_t faceFileNamesBuff; 58 MDToDBuff_t imageQualitiesBuff; 59 MDToDBuff_t faceEmbeddingsBuff; 60 } MDToDResult_t; 61 } // namespace mindspore 62 63 using (*MDToDApi_pathTest_t)(const char *path) = int; 64 using (*MDToDApi_testAlbum_t)() = int; 65 using *(*MDToDApi_createPipeLine_t)(MDToDConf_t MDConf) = MDToDApi; 66 using (*MDToDApi_GetNext_t)(MDToDApi *pMDToDApi, MDToDResult_t *results) = int; 67 using (*MDToDApi_UpdateEmbeding_t)(MDToDApi *pMDToDApi, const char *column, float *emmbeddings, 68 size_t emmbeddingsSize) = int; 69 using (*MDToDApi_UpdateStringArray_t)(MDToDApi *pMDToDApi, const char *column, MDToDBuff_t MDbuff) = int; 70 using (*MDToDApi_UpdateFloatArray_t)(MDToDApi *pMDToDApi, const char *column, MDToDBuff_t MDbuff) = int; 71 using (*MDToDApi_UpdateIsForTrain_t)(MDToDApi *pMDToDApi, uint8_t isForTrain) = int; 72 using (*MDToDApi_UpdateNoOfFaces_t)(MDToDApi *pMDToDApi, int32_t noOfFaces) = int; 73 using (*MDToDApi_Stop_t)(MDToDApi *pMDToDApi) = int; 74 using (*MDToDApi_Destroy_t)(MDToDApi *pMDToDApi) = int; 75 76 #endif 77