Skip to content
Merged
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
8 changes: 4 additions & 4 deletions SerialPrograms/Source/ML/Programs/ML_LabelImages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ void LabelImages::load_image_related_data(const std::string& image_path, size_t

// see if we can load the previously created labels
const std::string anno_filename = std::filesystem::path(image_path).filename().replace_extension(".json").string();
const std::string image_folder_path = std::filesystem::path(image_path).parent_path().string() + "/";

// ensure the folder exists
std::filesystem::create_directory(ML_ANNOTATION_PATH());
m_annotation_file_path = ML_ANNOTATION_PATH() + anno_filename;
// std::filesystem::create_directory(ML_ANNOTATION_PATH());
m_annotation_file_path = image_folder_path + anno_filename; // ML_ANNOTATION_PATH() + anno_filename;
if (!std::filesystem::exists(m_annotation_file_path)){
cout << "Annotataion output path, " << m_annotation_file_path << " does not exist yet" << endl;
return;
Expand Down Expand Up @@ -641,7 +641,7 @@ std::pair<double, double> LabelImages::pixel_to_float(size_t x, size_t y) const{
void LabelImages::export_to_yolov5_dataset(const std::string& image_folder_path, const std::string& dataset_path){
m_yolo_config_file_path = dataset_path;

export_image_annotations_to_yolo_dataset(image_folder_path, ML_ANNOTATION_PATH(), dataset_path);
export_image_annotations_to_yolo_dataset(image_folder_path, image_folder_path, dataset_path); // image_folder_path, ML_ANNOTATION_PATH(), dataset_path);
}


Expand Down
2 changes: 1 addition & 1 deletion SerialPrograms/Source/ML/Programs/ML_LabelImages.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class LabelImages : public PanelInstance, public ConfigOption::Listener {

// Load image related data:
// - Image SAM embedding data file, which has the same file path but with a name suffix ".embedding"
// - Existing annotation file, which is stored in a pre-defined ML_ANNOTATION_PATH() and with the same filename as
// - Existing annotation file, which is stored in the same folder as the image and with the same filename as
// the image but with name extension replaced to be ".json".
void load_image_related_data(const std::string& image_path, const size_t source_image_width, const size_t source_image_height);

Expand Down
5 changes: 3 additions & 2 deletions SerialPrograms/Source/ML/Programs/ML_LabelImagesWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ LabelImages_Widget::LabelImages_Widget(
this->m_program.save_annotation_to_file();

// ensure the folder exists
std::filesystem::create_directory(ML_ANNOTATION_PATH());
QDesktopServices::openUrl(QUrl(QString::fromStdString("file:///" + ML_ANNOTATION_PATH())));
// std::filesystem::create_directory(ML_ANNOTATION_PATH());
// QDesktopServices::openUrl(QUrl(QString::fromStdString("file:///" + ML_ANNOTATION_PATH())));
QDesktopServices::openUrl(QUrl(QString::fromStdString("file:///" + m_image_display_widget->image_folder_path())));
});
connect(save_anno_button, &QPushButton::clicked, this, [this](bool){
this->m_program.save_annotation_to_file();
Expand Down