Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet
This commit is contained in:
@@ -65,6 +65,9 @@ public:
|
||||
bool dontLoadWeights;
|
||||
std::string fileImgList;
|
||||
std::string fileLabelList;
|
||||
std::string networkName;
|
||||
std::string networkNameRT;
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
+4
-3
@@ -121,17 +121,18 @@ void Network::print() {
|
||||
std::cout<<"\n";
|
||||
}
|
||||
const char *Network::getNetworkRTName(char *network_name){
|
||||
networkName = network_name;
|
||||
int network_name_len = strlen(network_name);
|
||||
char *RTName = (char *)malloc((network_name_len + 9)*sizeof(char));
|
||||
if (fp16){
|
||||
strcpy(RTName, network_name);
|
||||
strcat(RTName, "_fp16.rt");
|
||||
RTName[network_name_len + 7] = '\0';
|
||||
RTName[network_name_len + 8] = '\0';
|
||||
}
|
||||
else if (dla){
|
||||
strcpy(RTName, network_name);
|
||||
strcat(RTName, "_dla.rt");
|
||||
RTName[network_name_len + 6] = '\0';
|
||||
RTName[network_name_len + 7] = '\0';
|
||||
}
|
||||
|
||||
else if (int8){
|
||||
@@ -145,7 +146,7 @@ const char *Network::getNetworkRTName(char *network_name){
|
||||
strcat(RTName, "_fp32.rt");
|
||||
RTName[network_name_len + 8] = '\0';
|
||||
}
|
||||
|
||||
networkNameRT = RTName;
|
||||
return RTName;
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -74,9 +74,19 @@ NetworkRT::NetworkRT(Network *net, const char *name) {
|
||||
configRT->setFlag(BuilderFlag::kINT8);
|
||||
BatchStream calibrationStream(dim, 1, 100, //TODO: check if 100 images are sufficient to the calibration (or 4951)
|
||||
net->fileImgList, net->fileLabelList);
|
||||
std::string modelName = name;
|
||||
|
||||
/* The calibTableFilePath contains the path+filename of the calibration table.
|
||||
* Each calibration table can be found in the corresponding network folder (../Test/*).
|
||||
* Each network is located in a folder with the same name as the network.
|
||||
* If the folder has a different name, the calibration table is saved in build/ folder.
|
||||
*/
|
||||
std::string calib_table_name = "../tests/"+ net->networkName + "/" + net->networkNameRT.substr(0, net->networkNameRT.find('.')) + "-calibration.table";
|
||||
std::string calib_table_path = "../tests/"+ net->networkName;
|
||||
if(!fileExist((const char *)calib_table_path.c_str()))
|
||||
calib_table_name = "./" + net->networkNameRT.substr(0, net->networkNameRT.find('.')) + "-calibration.table";
|
||||
|
||||
calibrator.reset(new Int8EntropyCalibrator(calibrationStream, 1,
|
||||
"./" + modelName.substr(0, modelName.find('.')) + "-calibration.table",
|
||||
calib_table_name,
|
||||
"data"));
|
||||
configRT->setInt8Calibrator(calibrator.get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user