Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#cmake_minimum_required(VERSION 2.8)
# cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14.0)

set(CMAKE_C_COMPILER "gcc-4.9")
set(CMAKE_CXX_COMPILER "g++-4.9")

# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
# set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")

project(markup_tool)

# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") # -stdlib=libc++
Expand Down
50 changes: 41 additions & 9 deletions markup_backend/include/markup_backend/markup.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct PipelineRunParams {
std::string tracker_model_path = "";
std::string weights_path = "";
std::string tmp_video_dir = "/tmp/markup_video";
std::string debug_gt_tacks = "../markup_tool/data/test/MOT16-04/gt/gt.txt";
std::string tracks_path = "";
std::string tmp_img_extention = ".png";
size_t tmp_img_path_pad2length = 10;
std::string tracks_filename = "tracks.txt";
Expand All @@ -26,11 +26,7 @@ struct PipelineRunParams {
class MarkUp {
public:
bool get_frame(size_t frame_idx, std::vector<Detection>* detections) {
if (detections == nullptr) {
// TODO: Exceptions
std::cout << "No return container 'detections' provided!" << std::endl;
return false;
}
detections->clear();

detections->clear();

Expand Down Expand Up @@ -97,7 +93,25 @@ class MarkUp {
video_ = std::make_unique<Video>(params_.video_path);
}

bool set_tracks(const std::string& filepath) {
if (filepath.empty()) {
return false;
}

if (!boost::filesystem::exists(filepath)) {
// TODO: Exceptions
std::cout << "File not found:" << filepath << std::endl;
return false;
}

if (params_.tracks_path == filepath) {
return true;
}

track_container_.reset(nullptr);

params_.tracks_path = filepath;
}

bool run() {
track_container_.reset(nullptr);
Expand All @@ -114,15 +128,21 @@ class MarkUp {
return false;
}

if (params_.tracks_path.empty()) {
// TODO: Exceptions
std::cout << "File with tracks are not choosen" << std::endl;
return false;
}

// track_container_ = this->run_pipeline(*video_);

/* if (boost::filesystem::exists(params_.debug_gt_tacks)) {
/* if (boost::filesystem::exists(params_.tracks_path)) {
// TODO: Exceptions
std::cout << "No debug tracks:" << params_.debug_gt_tacks << std::endl;
std::cout << "No debug tracks:" << params_.tracks_path << std::endl;
return false;
}*/

track_container_ = read_dummy_trackcontainer(params_.debug_gt_tacks);
track_container_ = read_dummy_trackcontainer(params_.tracks_path);

return true;
}
Expand Down Expand Up @@ -190,6 +210,18 @@ class MarkUp {
return params_;
}

size_t get_video_len() const {
if (video_ == nullptr) {
return 0;
} else {
return video_->size();
}
}

PipelineRunParams get_params() const {
return params_;
}

private:
PipelineRunParams params_;
std::unique_ptr<Video> video_ = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions markup_backend/src/markup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ std::unique_ptr<TrackContainer> MarkUp::run_pipeline(const Video& video) {

//

// std::unique_ptr<TrackContainer> track_container(new TrackContainer(tracks_filepath));

return std::make_unique<TrackContainer>(tracks_filepath);
std::unique_ptr<TrackContainer> track_container(new TrackContainer(tracks_filepath));
}

3 changes: 2 additions & 1 deletion markup_backend/test/test_markup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ BOOST_AUTO_TEST_CASE(markup_logic)

BOOST_CHECK(mark_up->run());
for (size_t frame_idx = 0; frame_idx < mark_up->get_video_len(); ++frame_idx) {
BOOST_CHECK(mark_up->get_frame(frame_idx, &detections));
BOOST_CHECK(mark_up->get_frame(not_real_index, &detections));

BOOST_CHECK(!detections.empty());
for (const auto& det : detections) {
BOOST_CHECK_EQUAL(det.frame, frame_idx);
Expand Down
3 changes: 1 addition & 2 deletions markup_backend/test/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ BOOST_AUTO_TEST_CASE(read_det_from_file)

std::string det_filepath = "../../../markup_tool/data/test/MOT16-04/gt/gt.txt";
std::string video_filepath = "../../../markup_tool/data/test/MOT16-04/img1";
// std::string det_filepath = "../markup_tool/data/test/MOT16-04/gt/gt.txt";
// std::string video_filepath = "../markup_tool/data/test/MOT16-04/img1";

std::string debug_detections_dir = "/tmp/detections";
cv::Size test_img_size(1920, 1080);

Expand Down
3 changes: 2 additions & 1 deletion markup_frontend/include/markup_frontend/maincontrolpanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class MainControlPanel : public QWidget
explicit MainControlPanel(QWidget *parent = nullptr);

signals:
void send_path(QDir dir);
void send_video_path(QDir dir);
void send_tracks_path(QString path);
void send_run();

private slots:
Expand Down
5 changes: 3 additions & 2 deletions markup_frontend/include/markup_frontend/markupwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MarkupWidget : public QWidget

public slots:
void slot_set_video_path(QDir path);
void slot_set_tracks_path(QString path);
void slot_framechanged(FrameWithControl *fwc);
void slot_run();
void slot_delete_bbox(int track_id, int frameidx);
Expand All @@ -27,8 +28,8 @@ public slots:
private:
MainControlPanel *maincontrol = nullptr;

FrameWithControl *fwcup = nullptr;
FrameWithControl *fwcdn = nullptr;
FrameWithControl *upper_frame_panel = nullptr;
FrameWithControl *down_frame_panel = nullptr;

// проверить возможность удаления...
// QDir path;
Expand Down
5 changes: 3 additions & 2 deletions markup_frontend/src/maincontrolpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MainControlPanel::MainControlPanel(QWidget *parent) : QWidget(parent)
void MainControlPanel::slot_loadvideo() {
auto path = QFileDialog::getExistingDirectory(this, "Open Folder with frames");
QDir dir(path);
emit send_path(dir);
emit send_video_path(dir);
// call some backend-function
}

Expand All @@ -51,7 +51,8 @@ void MainControlPanel::slot_loadmodel() {

void MainControlPanel::slot_loadtracks() {
auto path = QFileDialog::getOpenFileName(this, "Open Tracks", "",
"*.tracks");
"*.txt");
emit send_tracks_path(path);
qDebug() << "tracks path : " << path;
// call some backend-function
}
Expand Down
22 changes: 14 additions & 8 deletions markup_frontend/src/markupwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ MarkupWidget::MarkupWidget(QWidget *parent)
: QWidget(parent)
{
maincontrol = new MainControlPanel(this);
fwcup = new FrameWithControl(this);
fwcdn = new FrameWithControl(this);
upper_frame_panel = new FrameWithControl(this);
down_frame_panel = new FrameWithControl(this);

QHBoxLayout *hlayout = new QHBoxLayout(this);
QVBoxLayout* fwclayout = new QVBoxLayout;

hlayout->addWidget(maincontrol);
hlayout->addLayout(fwclayout);

fwclayout->addWidget(fwcup);
fwclayout->addWidget(fwcdn);
fwclayout->addWidget(upper_frame_panel);
fwclayout->addWidget(down_frame_panel);

connect(maincontrol, &MainControlPanel::send_path, fwcup, &FrameWithControl::setPath);
connect(maincontrol, &MainControlPanel::send_path, fwcdn, &FrameWithControl::setPath);
connect(maincontrol, &MainControlPanel::send_path, this, &MarkupWidget::slot_set_video_path);
connect(maincontrol, &MainControlPanel::send_video_path, upper_frame_panel, &FrameWithControl::setPath);
connect(maincontrol, &MainControlPanel::send_video_path, down_frame_panel, &FrameWithControl::setPath);
connect(maincontrol, &MainControlPanel::send_video_path, this, &MarkupWidget::slot_set_video_path);

connect(maincontrol, &MainControlPanel::send_tracks_path, this, &MarkupWidget::slot_set_tracks_path);

connect(maincontrol, &MainControlPanel::send_run, this, &MarkupWidget::slot_run);

Expand All @@ -37,12 +39,16 @@ MarkupWidget::MarkupWidget(QWidget *parent)
connect(fwcdn, &FrameWithControl::send_delete_track, this, &MarkupWidget::slot_delete_track);
}

// тут нужно передавать путь в бекэнд... но сейчас некуда...
void MarkupWidget::slot_set_video_path(QDir path) {
markup.set_video(std::string(path.path().toUtf8().constData()));
path = path;
}

void MarkupWidget::slot_set_tracks_path(QString path) {
markup.set_tracks(std::string(path.toUtf8().constData()));
path = path;
}

void MarkupWidget::slot_run() {
qDebug() << "Rewrite using new MarkUp interface";
markup.run();
Expand Down