!9726 [Data]fix log warning bug

From: @xulei2020
Reviewed-by: @liucunwei,@pandoublefeng
Signed-off-by: @liucunwei
This commit is contained in:
mindspore-ci-bot 2020-12-09 20:37:47 +08:00 committed by Gitee
commit ad5e8deb50
2 changed files with 26 additions and 26 deletions

View File

@ -60,10 +60,10 @@ class MDToDApi {
public:
MDToDApi() : _iter(nullptr), _augs({}), _storage_folder(""), _file_id(-1), _hasBatch(false) {
MS_LOG(WARNING) << "MDToDAPI Call constractor";
MS_LOG(INFO) << "MDToDAPI Call constractor";
}
~MDToDApi() {
MS_LOG(WARNING) << "MDToDAPI Call destractor";
MS_LOG(INFO) << "MDToDAPI Call destractor";
// derefernce dataset and iterator
_augs.clear();
}
@ -85,14 +85,14 @@ extern "C"
int MDToDApi_pathTest(const char* path) {
Path f(path);
MS_LOG(WARNING) << f.Exists() << f.IsDirectory() << f.ParentPath();
MS_LOG(INFO) << f.Exists() << f.IsDirectory() << f.ParentPath();
// Print out the first few items in the directory
auto dir_it = Path::DirIterator::OpenDirectory(&f);
MS_LOG(WARNING) << dir_it.get();
MS_LOG(INFO) << dir_it.get();
int i = 0;
while (dir_it->hasNext()) {
Path v = dir_it->next();
MS_LOG(WARNING) << v.toString() << "\n";
MS_LOG(INFO) << v.toString() << "\n";
i++;
if (i > 5) break;
}
@ -100,38 +100,38 @@ int MDToDApi_pathTest(const char* path) {
}
extern "C" MDToDApi *MDToDApi_createPipeLine(MDToDConf_t MDConf) {
MS_LOG(WARNING) << "Start createPipeLine";
MS_LOG(INFO) << "Start createPipeLine";
std::string folder_path(MDConf.pFolderPath);
std::string schema_file(MDConf.pSchemFile);
std::vector<std::string> column_names = MDToDBuffToVector(MDConf.columnsToReadBuff);
if (std::find(column_names.begin(), column_names.end(), "id") == column_names.end()) {
MS_LOG(WARNING) << "Column id not foud adding it ";
MS_LOG(INFO) << "Column id not foud adding it ";
column_names.push_back("id");
}
std::vector<std::shared_ptr<TensorOperation>> mapOperations;
if (std::find(column_names.begin(), column_names.end(), "image") != column_names.end()) {
MS_LOG(WARNING) << "Found column image create map with:";
MS_LOG(WARNING) << "resize: { " << MDConf.ResizeSizeWH[0] << ", " << MDConf.ResizeSizeWH[1] << " }";
MS_LOG(WARNING) << "crop: { " << MDConf.CropSizeWH[0] << ", " << MDConf.CropSizeWH[1] << " }";
MS_LOG(WARNING) << "MEAN: { " << MDConf.MEAN[0] << ", " << MDConf.MEAN[1] << ", " << MDConf.MEAN[2] << " }";
MS_LOG(WARNING) << "STD: { " << MDConf.STD[0] << ", " << MDConf.STD[1] << ", " << MDConf.STD[2] << " }";
MS_LOG(INFO) << "Found column image create map with:";
MS_LOG(INFO) << "resize: { " << MDConf.ResizeSizeWH[0] << ", " << MDConf.ResizeSizeWH[1] << " }";
MS_LOG(INFO) << "crop: { " << MDConf.CropSizeWH[0] << ", " << MDConf.CropSizeWH[1] << " }";
MS_LOG(INFO) << "MEAN: { " << MDConf.MEAN[0] << ", " << MDConf.MEAN[1] << ", " << MDConf.MEAN[2] << " }";
MS_LOG(INFO) << "STD: { " << MDConf.STD[0] << ", " << MDConf.STD[1] << ", " << MDConf.STD[2] << " }";
if ((MDConf.ResizeSizeWH[0] != 0) && (MDConf.ResizeSizeWH[1] != 0)) {
std::shared_ptr<TensorOperation> resize_op =
mindspore::dataset::vision::Resize({MDConf.ResizeSizeWH[0], MDConf.ResizeSizeWH[1]});
MS_LOG(WARNING) << "Push back resize";
MS_LOG(INFO) << "Push back resize";
mapOperations.push_back(resize_op);
}
if (1 == MDConf.fixOrientation) {
std::shared_ptr<TensorOperation> rotate_op = mindspore::dataset::vision::Rotate();
MS_LOG(WARNING) << "Push back rotate";
MS_LOG(INFO) << "Push back rotate";
mapOperations.push_back(rotate_op);
// hasBatch = true; Batch not currently supported inMInddata-Lite
}
if ((MDConf.CropSizeWH[0] != 0) && (MDConf.CropSizeWH[1] != 0)) {
std::vector<int> Crop(MDConf.CropSizeWH, MDConf.CropSizeWH + 2);
std::shared_ptr<TensorOperation> center_crop_op = mindspore::dataset::vision::CenterCrop(Crop);
MS_LOG(WARNING) << "Push back crop";
MS_LOG(INFO) << "Push back crop";
mapOperations.push_back(center_crop_op);
// hasBatch = true; Batch not currently supported inMInddata-Lite
}
@ -274,7 +274,7 @@ extern "C" int MDToDApi_GetNext(MDToDApi *pMDToDApi, MDToDResult_t *results) {
uint32_t orientation = 0;
if (row.size() != 0 && ret) {
GetValue<uint32_t>(row, "orientation", &orientation);
MS_LOG(WARNING) << "get orientation from row = " << orientation;
MS_LOG(INFO) << "get orientation from row = " << orientation;
if ((pMDToDApi->_augs).size() > 0) {
// String and Tensors
@ -324,14 +324,14 @@ extern "C" int MDToDApi_GetNext(MDToDApi *pMDToDApi, MDToDResult_t *results) {
extern "C" int MDToDApi_Stop(MDToDApi *pMDToDApi) {
// Manually terminate the pipeline
MS_LOG(WARNING) << "pipline stoped";
MS_LOG(INFO) << "pipline stoped";
return 0;
}
extern "C" int MDToDApi_Destroy(MDToDApi *pMDToDApi) {
MS_LOG(WARNING) << "pipline deleted start";
MS_LOG(INFO) << "pipline deleted start";
delete pMDToDApi;
MS_LOG(WARNING) << "pipline deleted end";
MS_LOG(INFO) << "pipline deleted end";
return 0;
}

View File

@ -76,7 +76,7 @@ Status AlbumOp::PrescanEntry() {
if (schema_file_ == "" || !schema_file.Exists()) {
RETURN_STATUS_UNEXPECTED("Invalid file, schema_file is invalid or not set: " + schema_file_);
} else {
MS_LOG(WARNING) << "Schema file provided: " << schema_file_ << ".";
MS_LOG(INFO) << "Schema file provided: " << schema_file_ << ".";
data_schema_->LoadSchemaFile(schema_file_, columns_to_load_);
}
@ -86,7 +86,7 @@ Status AlbumOp::PrescanEntry() {
if (folder.Exists() == false || dirItr == nullptr) {
RETURN_STATUS_UNEXPECTED("Invalid file, failed to open folder: " + folder_path_);
}
MS_LOG(WARNING) << "Album folder Path found: " << folder_path_ << ".";
MS_LOG(INFO) << "Album folder Path found: " << folder_path_ << ".";
while (dirItr->hasNext()) {
Path file = dirItr->next();
@ -122,7 +122,7 @@ Status AlbumOp::PrescanEntry() {
// IMPORTANT: 1 IOBlock produces 1 DataBuffer
bool AlbumOp::GetNextRow(std::unordered_map<std::string, std::shared_ptr<Tensor>> *map_row) {
if (map_row == nullptr) {
MS_LOG(WARNING) << "GetNextRow in AlbumOp: the point of map_row is nullptr";
MS_LOG(ERROR) << "GetNextRow in AlbumOp: the point of map_row is nullptr";
return false;
}
@ -192,7 +192,7 @@ Status AlbumOp::LoadImageTensor(const std::string &image_file_path, uint32_t col
std::set<std::string> png_ext = {".png", ".PNG"};
if (png_ext.find(file.Extension()) != png_ext.end()) {
// load empty tensor since image is not jpg
MS_LOG(INFO) << "PNG!" << image_file_path << ".";
MS_LOG(INFO) << "load empty tensor since image is PNG" << image_file_path << ".";
RETURN_IF_NOT_OK(LoadEmptyTensor(col_num, tensor));
return Status::OK();
}
@ -229,7 +229,7 @@ Status AlbumOp::LoadImageTensor(const std::string &image_file_path, uint32_t col
int AlbumOp::GetOrientation(const std::string &folder_path) {
FILE *fp = fopen(folder_path.c_str(), "rb");
if (!fp) {
MS_LOG(WARNING) << "Can't read file for EXIF: file = " << folder_path;
MS_LOG(ERROR) << "Can't read file for EXIF: file = " << folder_path;
return 0;
}
fseek(fp, 0, SEEK_END);
@ -241,7 +241,7 @@ int AlbumOp::GetOrientation(const std::string &folder_path) {
}
unsigned char *buf = new unsigned char[fsize];
if (fread(buf, 1, fsize, fp) != fsize) {
MS_LOG(WARNING) << "read file size error for EXIF: file = " << folder_path;
MS_LOG(ERROR) << "read file size error for EXIF: file = " << folder_path;
delete[] buf;
fclose(fp);
return 0;
@ -252,7 +252,7 @@ int AlbumOp::GetOrientation(const std::string &folder_path) {
mindspore::dataset::ExifInfo result;
int code = result.parseOrientation(buf, fsize);
delete[] buf;
MS_LOG(WARNING) << "AlbumOp::GetOrientation: orientation= " << code << ".";
MS_LOG(INFO) << "AlbumOp::GetOrientation: orientation= " << code << ".";
return code;
}