Skip to content
Snippets Groups Projects
Unverified Commit 095f2b3f authored by i-robot's avatar i-robot Committed by Gitee
Browse files

!2609 add new model pcb to model_zoo

Merge pull request !2609 from gdm/master
parents 5107f25a d678d40f
No related branches found
No related tags found
No related merge requests found
Showing
with 2918 additions and 0 deletions
This diff is collapsed.
This diff is collapsed.
cmake_minimum_required(VERSION 3.14.1)
project(Ascend310Infer)
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -std=c++17 -Werror -Wall -fPIE -Wl,--allow-shlib-undefined")
set(PROJECT_SRC_ROOT ${CMAKE_CURRENT_LIST_DIR}/)
option(MINDSPORE_PATH "mindspore install path" "")
include_directories(${MINDSPORE_PATH})
include_directories(${MINDSPORE_PATH}/include)
include_directories(${PROJECT_SRC_ROOT})
find_library(MS_LIB libmindspore.so ${MINDSPORE_PATH}/lib)
file(GLOB_RECURSE MD_LIB ${MINDSPORE_PATH}/_c_dataengine*)
add_executable(main src/main.cc src/utils.cc)
target_link_libraries(main ${MS_LIB} ${MD_LIB} gflags)
#!/bin/bash
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
if [ ! -d out ]; then
mkdir out
fi
cd out || exit
cmake .. \
-DMINDSPORE_PATH="`pip show mindspore-ascend | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`"
make
/**
* Copyright 2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_INFERENCE_UTILS_H_
#define MINDSPORE_INFERENCE_UTILS_H_
#include <sys/stat.h>
#include <dirent.h>
#include <vector>
#include <string>
#include <memory>
#include "include/api/types.h"
DIR *OpenDir(std::string_view dirName);
std::string RealPath(std::string_view path);
mindspore::MSTensor ReadFileToTensor(const std::string &file);
int WriteResult(const std::string&, const std::vector<mindspore::MSTensor>&, const std::string&);
std::vector<std::string> GetAllFiles(std::string_view dir_name);
#endif
/**
* Copyright 2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sys/time.h>
#include <gflags/gflags.h>
#include <dirent.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <iosfwd>
#include <vector>
#include <fstream>
#include <sstream>
#include "include/api/model.h"
#include "include/api/context.h"
#include "include/api/types.h"
#include "include/api/serialization.h"
#include "include/dataset/vision_ascend.h"
#include "include/dataset/execute.h"
#include "include/dataset/transforms.h"
#include "include/dataset/vision.h"
#include "inc/utils.h"
using mindspore::dataset::vision::Decode;
using mindspore::dataset::vision::Resize;
using mindspore::dataset::vision::CenterCrop;
using mindspore::dataset::vision::Normalize;
using mindspore::dataset::vision::HWC2CHW;
using mindspore::dataset::TensorTransform;
using mindspore::Context;
using mindspore::Serialization;
using mindspore::Model;
using mindspore::Status;
using mindspore::ModelType;
using mindspore::GraphCell;
using mindspore::kSuccess;
using mindspore::MSTensor;
using mindspore::dataset::Execute;
DEFINE_string(mindir_path, "", "mindir path");
DEFINE_string(query_image_path, "", "query image path");
DEFINE_string(gallery_image_path, "", "gallery image path");
DEFINE_int32(device_id, 0, "device id");
int main(int argc, char **argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
if (RealPath(FLAGS_mindir_path).empty()) {
std::cout << "Invalid mindir" << std::endl;
return 1;
}
auto context = std::make_shared<Context>();
auto ascend310 = std::make_shared<mindspore::Ascend310DeviceInfo>();
ascend310->SetDeviceID(FLAGS_device_id);
context->MutableDeviceInfo().push_back(ascend310);
mindspore::Graph graph;
Serialization::Load(FLAGS_mindir_path, ModelType::kMindIR, &graph);
Model model;
Status ret = model.Build(GraphCell(graph), context);
if (ret != kSuccess) {
std::cout << "ERROR: Build failed." << std::endl;
return 1;
}
auto query_image_files = GetAllFiles(FLAGS_query_image_path);
if (query_image_files.empty()) {
std::cout << "ERROR: no query data." << std::endl;
return 1;
}
auto gallery_image_files = GetAllFiles(FLAGS_gallery_image_path);
if (gallery_image_files.empty()) {
std::cout << "ERROR: no gallery data." << std::endl;
return 1;
}
std::vector<MSTensor> modelInputs = model.GetInputs();
std::map<double, double> costTime_map;
size_t query_size = query_image_files.size();
size_t gallery_size = gallery_image_files.size();
std::string query_saveDir = "./query_result_files";
std::string gallery_saveDir = "./gallery_result_files";
for (size_t i = 0; i < query_size; ++i) {
struct timeval start = {0};
struct timeval end = {0};
double startTimeMs;
double endTimeMs;
std::vector<MSTensor> inputs;
std::vector<MSTensor> outputs;
std::cout << "Start processing query image files:" << query_image_files[i] <<std::endl;
MSTensor image = ReadFileToTensor(query_image_files[i]);
inputs.emplace_back(modelInputs[0].Name(), modelInputs[0].DataType(), modelInputs[0].Shape(),
image.Data().get(), image.DataSize());
gettimeofday(&start, nullptr);
ret = model.Predict(inputs, &outputs);
gettimeofday(&end, nullptr);
if (ret != kSuccess) {
std::cout << "Process " << query_image_files[i] << " failed." << std::endl;
return 1;
}
startTimeMs = (1.0 * start.tv_sec * 1000000 + start.tv_usec) / 1000;
endTimeMs = (1.0 * end.tv_sec * 1000000 + end.tv_usec) / 1000;
costTime_map.insert(std::pair<double, double>(startTimeMs, endTimeMs));
WriteResult(query_image_files[i], outputs, query_saveDir);
}
for (size_t i = 0; i < gallery_size; ++i) {
struct timeval start = {0};
struct timeval end = {0};
double startTimeMs;
double endTimeMs;
std::vector<MSTensor> inputs;
std::vector<MSTensor> outputs;
std::cout << "Start processing gallery files:" << gallery_image_files[i] <<std::endl;
MSTensor image = ReadFileToTensor(gallery_image_files[i]);
inputs.emplace_back(modelInputs[0].Name(), modelInputs[0].DataType(), modelInputs[0].Shape(),
image.Data().get(), image.DataSize());
gettimeofday(&start, nullptr);
ret = model.Predict(inputs, &outputs);
gettimeofday(&end, nullptr);
if (ret != kSuccess) {
std::cout << "Process " << gallery_image_files[i] << " failed." << std::endl;
return 1;
}
startTimeMs = (1.0 * start.tv_sec * 1000000 + start.tv_usec) / 1000;
endTimeMs = (1.0 * end.tv_sec * 1000000 + end.tv_usec) / 1000;
costTime_map.insert(std::pair<double, double>(startTimeMs, endTimeMs));
WriteResult(gallery_image_files[i], outputs, gallery_saveDir);
}
double average = 0.0;
int inferCount = 0;
for (auto iter = costTime_map.begin(); iter != costTime_map.end(); iter++) {
average += iter->second - iter->first;
inferCount++;
}
average = average / inferCount;
std::stringstream timeCost;
timeCost << "NN inference cost average time: "<< average << " ms of infer_count " << inferCount << std::endl;
std::cout << "NN inference cost average time: "<< average << "ms of infer_count " << inferCount << std::endl;
std::string fileName = "./time_Result" + std::string("/test_perform_static.txt");
std::ofstream fileStream(fileName.c_str(), std::ios::trunc);
fileStream << timeCost.str();
fileStream.close();
costTime_map.clear();
return 0;
}
/**
* Copyright 2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fstream>
#include <algorithm>
#include <iostream>
#include "inc/utils.h"
using mindspore::MSTensor;
using mindspore::DataType;
std::vector<std::string> GetAllFiles(std::string_view dirName) {
struct dirent *filename;
DIR *dir = OpenDir(dirName);
if (dir == nullptr) {
return {};
}
std::vector<std::string> res;
while ((filename = readdir(dir)) != nullptr) {
std::string dName = std::string(filename->d_name);
if (dName == "." || dName == ".." || filename->d_type != DT_REG) {
continue;
}
res.emplace_back(std::string(dirName) + "/" + filename->d_name);
}
std::sort(res.begin(), res.end());
for (auto &f : res) {
std::cout << "image file: " << f << std::endl;
}
return res;
}
mindspore::MSTensor ReadFileToTensor(const std::string &file) {
if (file.empty()) {
std::cout << "Pointer file is nullptr" << std::endl;
return mindspore::MSTensor();
}
std::ifstream ifs(file);
if (!ifs.good()) {
std::cout << "File: " << file << " is not exist" << std::endl;
return mindspore::MSTensor();
}
if (!ifs.is_open()) {
std::cout << "File: " << file << "open failed" << std::endl;
return mindspore::MSTensor();
}
ifs.seekg(0, std::ios::end);
size_t size = ifs.tellg();
mindspore::MSTensor buffer(file, mindspore::DataType::kNumberTypeUInt8, {static_cast<int64_t>(size)}, nullptr, size);
ifs.seekg(0, std::ios::beg);
ifs.read(reinterpret_cast<char *>(buffer.MutableData()), size);
ifs.close();
return buffer;
}
int WriteResult(const std::string& imageFile, const std::vector<MSTensor> &outputs, const std::string& saveDir) {
for (size_t i = 0; i < outputs.size(); ++i) {
size_t outputSize;
std::shared_ptr<const void> netOutput;
netOutput = outputs[i].Data();
outputSize = outputs[i].DataSize();
int pos = imageFile.rfind('/');
std::string fileName(imageFile, pos + 1);
fileName.replace(fileName.find('.'), fileName.size() - fileName.find('.'), ".bin");
std::string outFileName = saveDir + "/" + fileName;
FILE *outputFile = fopen(outFileName.c_str(), "wb");
fwrite(netOutput.get(), outputSize, sizeof(char), outputFile);
fclose(outputFile);
outputFile = nullptr;
}
return 0;
}
DIR *OpenDir(std::string_view dirName) {
if (dirName.empty()) {
std::cout << " dirName is null ! " << std::endl;
return nullptr;
}
std::string realPath = RealPath(dirName);
struct stat s;
lstat(realPath.c_str(), &s);
if (!S_ISDIR(s.st_mode)) {
std::cout << "dirName is not a valid directory !" << std::endl;
return nullptr;
}
DIR *dir;
dir = opendir(realPath.c_str());
if (dir == nullptr) {
std::cout << "Can not open dir " << dirName << std::endl;
return nullptr;
}
std::cout << "Successfully opened the dir " << dirName << std::endl;
return dir;
}
std::string RealPath(std::string_view path) {
char realPathMem[PATH_MAX] = {0};
char *realPathRet = nullptr;
realPathRet = realpath(path.data(), realPathMem);
if (realPathRet == nullptr) {
std::cout << "File: " << path << " is not exist.";
return "";
}
std::string realPath(realPathMem);
std::cout << path << " realpath is: " << realPath << std::endl;
return realPath;
}
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/"
checkpoint_save_path: "./checkpoint/"
checkpoint_file_path: "/cache/load_checkpoint/pretrained_resnet50.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 1
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "PCB"
# optimizer setting
learning_rate: 0.1
lr_mult: 0.1
decay_rate: 0.1
momentum: 0.9
weight_decay: 5e-4
nesterov: True
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 1
epoch_size: 10
decay_epoch_size: 10
warmup_epoch_size: 0
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 10
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
# Export setting
device_id: 0
image_height: 384
image_width: 128
file_name: "export_PCB_test"
file_format: "MINDIR"
# preprocess setting
preprocess_result_path: "./preprocess_Result"
# postprocessing setting
query_prediction_path: "./query_result_files"
gallery_prediction_path: "./gallery_result_files"
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/cuhk03/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/PCB-45_115.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "PCB"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/duke/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/PCB-60_258.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "duke"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "PCB"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/market/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/PCB-60_202.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "market"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "PCB"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/RPP/cuhk03/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/RPP-10_115.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "RPP"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/RPP/duke/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/RPP-40_258.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "duke"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "RPP"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/RPP/market/eval/"
checkpoint_save_path: ""
checkpoint_file_path: "/cache/load_checkpoint/RPP-10_202.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "market"
batch_size: 64
num_parallel_workers: 4
# model setting
model_name: "RPP"
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/"
checkpoint_save_path: "./checkpoint/"
checkpoint_file_path: "/cache/load_checkpoint/RPP-10_115.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 1
num_parallel_workers: 4
# model setting
model_name: "RPP"
use_G_feature: True
# Export setting
image_height: 384
image_width: 128
file_name: "export_RPP_cuhk03_G"
file_format: "MINDIR"
# preprocess setting
preprocess_result_path: "./preprocess_Result"
# postprocessing setting
query_prediction_path: "./query_result_files"
gallery_prediction_path: "./gallery_result_files"
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/cuhk03/train"
checkpoint_save_path: "./checkpoint/PCB/cuhk03/train"
checkpoint_file_path: "/cache/load_checkpoint/PCB-40_115.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 64
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "PCB"
# optimizer setting
learning_rate: 0.05
lr_mult: 0.1
decay_rate: 0.5
momentum: 0.9
weight_decay: 5e-4
nesterov: True
loss_scale: 1.0
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 1
epoch_size: 45
decay_epoch_size: 15
warmup_epoch_size: 0
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 45
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/cuhk03/train"
checkpoint_save_path: "./checkpoint/PCB/cuhk03/train"
checkpoint_file_path: "/cache/load_checkpoint/pretrained_resnet50.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 64
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "PCB"
# optimizer setting
learning_rate: 0.1
lr_mult: 0.1
decay_rate: 0.1
momentum: 0.9
weight_decay: 5e-4
nesterov: True
loss_scale: 1.0
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 1
epoch_size: 40
decay_epoch_size: 40
warmup_epoch_size: 0
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 40
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/duke/train"
checkpoint_save_path: "./checkpoint/PCB/duke/train"
checkpoint_file_path: "/cache/load_checkpoint/pretrained_resnet50.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "duke"
batch_size: 64
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "PCB"
# optimizer setting
learning_rate: 0.1
lr_mult: 0.1
decay_rate: 0.1
momentum: 0.9
weight_decay: 5e-4
nesterov: True
loss_scale: 1.0
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 1
epoch_size: 60
decay_epoch_size: 40
warmup_epoch_size: 0
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 60
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/PCB/market/train"
checkpoint_save_path: "./checkpoint/PCB/market/train"
checkpoint_file_path: "/cache/load_checkpoint/pretrained_resnet50.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "market"
batch_size: 64
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "PCB"
# optimizer setting
learning_rate: 0.1
lr_mult: 0.1
decay_rate: 0.1
momentum: 0.9
weight_decay: 5e-4
nesterov: True
loss_scale: 1.0
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 37
epoch_size: 60
decay_epoch_size: 40
warmup_epoch_size: 1
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 60
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
# Builtin Configurations(DO NOT CHANGE THESE CONFIGURATIONS unless you know exactly what you are doing)
enable_modelarts: False
# Url for modelarts
data_url: ""
train_url: ""
checkpoint_url: ""
# Path for local
run_distribute: False
enable_profiling: False
dataset_path: "/cache/dataset/"
output_path: "/cache/output/"
load_path: "/cache/load_checkpoint/"
device_target: "Ascend"
log_save_path: "./log/RPP/cuhk03/train"
checkpoint_save_path: "./checkpoint/RPP/cuhk03/train"
checkpoint_file_path: "/cache/load_checkpoint/RPP-45_115.ckpt"
# =========================================================================
# dataset setting
mindrecord_dir: "./MindRecord"
dataset_name: "cuhk03"
batch_size: 64
num_parallel_workers: 4
device_num: 1
# model setting
model_name: "RPP"
# optimizer setting
learning_rate: 0.005
lr_mult: 0.5
decay_rate: 0.5
momentum: 0.9
weight_decay: 5e-4
nesterov: True
loss_scale: 1.0
# training setting
mode_name: "GRAPH"
sink_mode: True
seed: 37
epoch_size: 10
decay_epoch_size: 10
warmup_epoch_size: 0
# checkpoint callbacks setting
save_checkpoint: True
save_checkpoint_epochs: 10
keep_checkpoint_max: 15
# EvalCallBack setting
run_eval: False
eval_interval: 15
eval_start_epoch: 60
use_G_feature: True
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment