AllentDan/LibtorchSegmentation

Please provide cmake

mprabhakarece opened this issue · 15 comments

I am trying run this code in ubuntu OS but it is giving some file missing error. Kindly share me cmake file for the given post.

Hi, @mprabhakarece. Sorry for the late reply. Well, there is no available Ubuntu machines for me to test. But I suggest you to write cmake files from simple stages like only do libtorch inference. Then add my code to the project one by one.

If you get any progess for cmake, feel free to pull request to help more people like you.

Thanks for your reply. It was mentioned This project is under developing. Kindly let me know whether it is possible to start training with available source code in this repo.

@mprabhakarece Codes are already proved to be ok for training using Visual Studio and Qt creator. I guess there is no ends for this project as more and more architectures and backbones are thriving....

@AllentDan Hi AllentDan. Finally I have created cmake. But io.h file is not available. So not able to complete the process.
Do support if possible.

@mprabhakarece My fault, I forgot that it was different for linux and windows to do IO. I suggest you comment the line "#include <io.h>" in Segmentor.h and util.h. Then comment all codes in load_seg_data_from_folder function in util.cpp to make the project compilable. Then, you can open the project in linux and add your own IO codes inside load_seg_data_from_folder.

I will get a linux machine someday and make the project compatible between different platform. But that will take some time for like a few months.... Thank you for your pointing out.

@AllentDan I have created cmake and trying to run. But I couldn't find any alternate for ‘_A_SUBDIR’ and ‘_findnext’ in util.cpp and getting error. Kindly suggest me alternate.

@mprabhakarece I merged a linux compatible branch from @zhongqingyang. You can try it directly

@AllentDan Thank you so much for your effort. _dirent.h seems like windows dependent and I am getting errors.

Replace the codes "#include "_dirent.h"" in readfile.h with:

#ifdef _WIN32
#include "_dirent.h"
#else
#include <dirent.h>

@AllentDan
Facing below error while loading segmentor.pt
20210412_160313

@AllentDan
加载segmentor.pt时遇到以下错误
20210412_160313
Please provide your main.cpp

main.cpp

#include<iostream>
#include"Segmentor.h"
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
    cv::Mat image = cv::imread("/home/hcl/prabha'/SegmentationCpp-main/voc_person_seg/val/2007_004000.jpg");

if(image.empty())
{
cout<<"Image empty";
}

    Segmentor<PAN> segmentor;
    segmentor.Initialize(0,512,512,{"background","person"},
                         "resnet34","/home/hcl/prabha'/SegmentationCpp-main/resnet34.pt");

    segmentor.LoadWeight("/home/hcl/prabha'/SegmentationCpp-main/segmentor.pt");
   /*  segmentor.Predict(image,"person");
   segmentor.Train(0.0003,300,4,"/home/hcl/prabha'/SegmentationCpp-main/voc_person_seg",".jpg","segmentor.pt");
*/
    return 0;
}

@mprabhakarece My provided weight was FPN with resnet34. You can train your own if you use PAN.

@AllentDan Thank you so much. And I am very grateful for the support I am getting.
I can run and predict using given code. I have few doubts.

  1. Given code is for both inference and training?
  2. How to train my own dataset.
  3. How to check the progress of training.

@mprabhakarece You can star me if you like the project.

  1. Train and inference.
  2. Readme shows how to create a dataset through lableme. If you want to train dataset with other lable form, change the IO and dataloading part.
  3. Codes have prints.....