mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
PascalVOC label scripts are updated
This commit is contained in:
@ -10,10 +10,10 @@ classes = ["aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat"
|
|||||||
|
|
||||||
|
|
||||||
def convert(size, box):
|
def convert(size, box):
|
||||||
dw = 1./size[0]
|
dw = 1./(size[0])
|
||||||
dh = 1./size[1]
|
dh = 1./(size[1])
|
||||||
x = (box[0] + box[1])/2.0
|
x = (box[0] + box[1])/2.0 - 1
|
||||||
y = (box[2] + box[3])/2.0
|
y = (box[2] + box[3])/2.0 - 1
|
||||||
w = box[1] - box[0]
|
w = box[1] - box[0]
|
||||||
h = box[3] - box[2]
|
h = box[3] - box[2]
|
||||||
x = x*dw
|
x = x*dw
|
||||||
@ -34,7 +34,7 @@ def convert_annotation(year, image_id):
|
|||||||
for obj in root.iter('object'):
|
for obj in root.iter('object'):
|
||||||
difficult = obj.find('difficult').text
|
difficult = obj.find('difficult').text
|
||||||
cls = obj.find('name').text
|
cls = obj.find('name').text
|
||||||
if cls not in classes or int(difficult) == 1:
|
if cls not in classes or int(difficult)==1:
|
||||||
continue
|
continue
|
||||||
cls_id = classes.index(cls)
|
cls_id = classes.index(cls)
|
||||||
xmlbox = obj.find('bndbox')
|
xmlbox = obj.find('bndbox')
|
||||||
@ -54,3 +54,6 @@ for year, image_set in sets:
|
|||||||
convert_annotation(year, image_id)
|
convert_annotation(year, image_id)
|
||||||
list_file.close()
|
list_file.close()
|
||||||
|
|
||||||
|
os.system("cat 2007_train.txt 2007_val.txt 2012_train.txt 2012_val.txt > train.txt")
|
||||||
|
os.system("cat 2007_train.txt 2007_val.txt 2007_test.txt 2012_train.txt 2012_val.txt > train.all.txt")
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ classes = ["aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat"
|
|||||||
|
|
||||||
|
|
||||||
def convert(size, box):
|
def convert(size, box):
|
||||||
dw = 1./size[0]
|
dw = 1./(size[0])
|
||||||
dh = 1./size[1]
|
dh = 1./(size[1])
|
||||||
x = (box[0] + box[1])/2.0
|
x = (box[0] + box[1])/2.0 - 1
|
||||||
y = (box[2] + box[3])/2.0
|
y = (box[2] + box[3])/2.0 - 1
|
||||||
w = box[1] - box[0]
|
w = box[1] - box[0]
|
||||||
h = box[3] - box[2]
|
h = box[3] - box[2]
|
||||||
x = x*dw
|
x = x*dw
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef YOLODLL_EXPORTS
|
#ifdef YOLODLL_EXPORTS
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define YOLODLL_API __declspec(dllexport)
|
#define YOLODLL_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define YOLODLL_API __attribute__((visibility("default")))
|
#define YOLODLL_API __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define YOLODLL_API __declspec(dllimport)
|
#define YOLODLL_API __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define YOLODLL_API
|
#define YOLODLL_API
|
||||||
#endif
|
#endif
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
YOLODLL_API int get_net_height() const;
|
YOLODLL_API int get_net_height() const;
|
||||||
YOLODLL_API int get_net_color_depth() const;
|
YOLODLL_API int get_net_color_depth() const;
|
||||||
|
|
||||||
YOLODLL_API std::vector<bbox_t> tracking_id(std::vector<bbox_t> cur_bbox_vec, bool const change_history = true,
|
YOLODLL_API std::vector<bbox_t> tracking_id(std::vector<bbox_t> cur_bbox_vec, bool const change_history = true,
|
||||||
int const frames_story = 10, int const max_dist = 150);
|
int const frames_story = 10, int const max_dist = 150);
|
||||||
|
|
||||||
std::vector<bbox_t> detect_resized(image_t img, int init_w, int init_h, float thresh = 0.2, bool use_mean = false)
|
std::vector<bbox_t> detect_resized(image_t img, int init_w, int init_h, float thresh = 0.2, bool use_mean = false)
|
||||||
@ -97,14 +97,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (mat.data == NULL) return std::shared_ptr<image_t>(NULL);
|
if (mat.data == NULL) return std::shared_ptr<image_t>(NULL);
|
||||||
|
|
||||||
cv::Size s = mat.size();
|
cv::Size network_size = cv::Size(get_net_width(), get_net_height());
|
||||||
if (get_net_width() != s.width || get_net_height() != s.height) {
|
cv::Mat det_mat;
|
||||||
cv::Mat det_mat;
|
if (mat.size() != network_size)
|
||||||
cv::resize(mat, det_mat, cv::Size(get_net_width(), get_net_height()));
|
cv::resize(mat, det_mat, network_size);
|
||||||
return mat_to_image(det_mat);
|
else
|
||||||
}
|
det_mat = mat; // only reference is copied
|
||||||
|
|
||||||
return mat_to_image(mat);
|
return mat_to_image(det_mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src)
|
static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src)
|
||||||
@ -304,7 +304,7 @@ public:
|
|||||||
|
|
||||||
std::vector<bbox_t> result_bbox_vec;
|
std::vector<bbox_t> result_bbox_vec;
|
||||||
|
|
||||||
if (err_cpu.cols == cur_bbox_vec.size() && status_cpu.cols == cur_bbox_vec.size())
|
if (err_cpu.cols == cur_bbox_vec.size() && status_cpu.cols == cur_bbox_vec.size())
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < cur_bbox_vec.size(); ++i)
|
for (size_t i = 0; i < cur_bbox_vec.size(); ++i)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user