Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase descriptions of input files for us lay people #8

Closed
Steven-N-Hart opened this issue Feb 16, 2017 · 31 comments
Closed

increase descriptions of input files for us lay people #8

Steven-N-Hart opened this issue Feb 16, 2017 · 31 comments

Comments

@Steven-N-Hart
Copy link

Could you perhaps provide a description of val3.txt and train3.txt? For instance, is the file nomenclature somehow significant?

It is not entirely clear on how one would make their own training images.

I looked at the examples in TensorVision, but it too does not really explain what the masks are. It just labels them GT:

    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_00.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_00_GT.png"
    },
    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_01.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_01_GT.png"
    },
    {
        "raw": "/home/moose/GitHub/MediSeg/DATA/OP1/img_02.png",
        "mask": "/home/moose/GitHub/MediSeg/DATA/OP1/img_02_GT.png
}
]

THANKS

@kyoseoksong
Copy link

I would like to know how I can structure my own datasets, too.
Can you elaborate on it, please?

@MarvinTeichmann
Copy link
Owner

An example of a val3.txt and train3.txt can be found in data. Each line of those files contains pathes to two images. The first image is the input image and the second the ground_truth image. Both pathes are seperated with a withe space. The paths are given relative to the location of the .txt file.

Hope this helps!

@Steven-N-Hart
Copy link
Author

OK. I think I understand a bit more now, and will elaborate here so that when I forget, I can just come back :).
The train3.txt file is a space-separated file with column 1 being the path to an image and column 2 to a mask. The mask file is a re-colored version of the image in column 1, with colors indicated by what the user inputs into KittiSeg.json in the data section:

"road_color" : [255,0,255],
"background_color" : [255,0,0],

train3.txt is a list of image pairs for training
val3.txt is a list of image pairs for validation

So, if one wants to train KittiSeg on their own data, they must create the image masks on their own images, and remove the references to the road data.

Does this sound about right?

@MarvinTeichmann
Copy link
Owner

That sounds about right. I would usually call the second image ground_truth or label.

MarvinTeichmann added a commit that referenced this issue Feb 16, 2017
* Update README.md

Slight improvment and  adding a description of the input format. Adresses #8
@MarvinTeichmann
Copy link
Owner

I have created input.md, which is supposed to describing the input format in detail. Feel free to modify this file or add details if you feel this is needed for better understandability. As author it is sometime hard to see what aspects are obvious ;).

@MarvinTeichmann
Copy link
Owner

Providing input.md should also fix this issue :).

@kyoseoksong
Copy link

kyoseoksong commented Feb 17, 2017 via email

@MarvinTeichmann
Copy link
Owner

MarvinTeichmann commented Feb 17, 2017

Hi kyoseoksong,

are you doing classification or segmentation? The code is build for segmentation, which is basically "classification per pixel". If you are solving segmentation, you can use the code as given, including kitti_seg_input.py and kitti_eval.py. Just make sure, that you set road_color and background_color correctly.

kitti_eval.py will compute the scores of the kitti benchmark (maxF1 and averagePrecision). If you have your own dataset which comes with different metrics you will eventually want to implement you own evaluation code at some point. But this does not influence training, so I would suggest starting of with this code and modify the evaluation once it is running fine.

If you are actually doing classification, you need to use an input producer and evaluation module for classification. You can find examples for both in my KittiClass project.

@kyoseoksong
Copy link

kyoseoksong commented Feb 17, 2017 via email

MarvinTeichmann added a commit that referenced this issue Feb 17, 2017
This makes the code compatible with greyscale data. Addresses comment in #8.
MarvinTeichmann added a commit that referenced this issue Feb 17, 2017
This makes the code compatible with greyscale data. Addresses comment in #8.
@MarvinTeichmann
Copy link
Owner

MarvinTeichmann commented Feb 17, 2017

Happy to help. Don't forget to cite one of my papers, if you get any chance ;).

Since f7fdb24, using greyscale images work out-of-the box. The images will be converted to RGB upon load, so a black pixel has value [0,0,0], white [255,255,255] and some light grey can be [200, 200, 200].

@kyoseoksong
Copy link

kyoseoksong commented Feb 19, 2017 via email

@MarvinTeichmann
Copy link
Owner

Hi Andy,

commit 0e8d548 moved it to docu/inputs.md.

Marvin

@kyoseoksong
Copy link

kyoseoksong commented Feb 19, 2017 via email

@lemhell
Copy link

lemhell commented Apr 7, 2017

Hello, @MarvinTeichmann
I want to train this model on my own dataset.
I created the necessary files train_file and val_file, specified road_color and background_color.
But when I call tv-train --hypes myHype.json, the output is:
ERROR Data URL for Kitti Data not provided.
ERROR Please visit: http://www.cvlibs.net/download.php?file=data_road.zip
ERROR and request Kitti Download link.
ERROR Enter URL in hypes/kittiSeg.json

I'm downloading this data right now (got link by e-mail and started tv-train again), but I don't see, why do I need it to train on my own data, or maybe I just did something wrong. Can you help me?
Thank you in advance.

@obendidi
Copy link

obendidi commented Apr 7, 2017

I believe you should comment the line 127 in the script train.py , that's the line responsible for downloading the dataset, after commenting it it will just use directly the path's that you provided on the hypes for your own data

@lemhell
Copy link

lemhell commented Apr 8, 2017

Thank you, for your response, @Bendidi @MarvinTeichmann
Are you sure that I should comment this line?
First of all, I'm using tv-train, not train.py (but maybe tv-train calls train.py)
Secondly, line 127 is train.do_training(hypes), looks like it is connected to the training, not to the download process. Haven't tested this yet, though.
EDIT: I guess, I should comment the 123rd line: train.maybe_download_and_extract(hypes)
Will check it now

@obendidi
Copy link

obendidi commented Apr 8, 2017

yes it's the 123 rd line ,sorry about that , I added some lines in my script that I forgot about , if you made your input configuration correctly , it should work now

@lemhell
Copy link

lemhell commented Apr 8, 2017

@Bendidi Thank you for the clarification.
All I did:
created my train.txt and val.txt with the following structure:
path_to_img/img1.jpg path_to_mask/mask1.png
And so on.
Then, I copied the hype file and changed paths in it for train_file and val_file and changed road_color and background_color accordingly.
Then, I commented line 123 and changed one import from commentjson to json (It was returning the same error, as Issue 28).
After that, I'm starting this:
python train.py --hypes hypes/MyHype.json
And get the same error, as in Issue 35

Have you done something differently in order to train this model on your custom data?
Also, my images are 3D and masks are 2D, but I've seen somewhere in the issues that this should work just fine.

@obendidi
Copy link

obendidi commented Apr 8, 2017

I've done something different , I completely changed the input script , so that I just have to give it a path , and it loads the images directly without the need of train.txt and val.txt , I also added a line to resize images to the same shape as kitti images , the images and the masks should be 'RGB' I believe (I don't know what you mean by 3D and 2D )
for 2 colors I got it working just fine with this setup , and the result was satisfying for the most part , hope it helps you

@lemhell
Copy link

lemhell commented Apr 8, 2017

By the input script you mean "input_file" field inside the hypes json? By default it's this one: "../inputs/kitti_seg_input.py"
If I understand you correctly, you did not changed anything beside that "input_file" script.
By 3D I meant RGB and by 2D - grayscale images.

@obendidi
Copy link

obendidi commented Apr 8, 2017

yes it's the kitti_seg_input.py script ,

The problem might be because you use grayscale images for the mask , and the image reader reads them in RGB mode as seen in line 123 of the input file and so it won't find the colors that you provided in the hypes file , to create the training variables , lines 157 and 158

@lemhell
Copy link

lemhell commented Apr 8, 2017

I changed the masks to be in RGB as well, but the problem persists: ValueError: No variables provided.
Do you have any code so I could compare?
Also, did you have the problem with inability to import dump from commentjson?

@obendidi
Copy link

obendidi commented Apr 8, 2017

nope , commentjson worked fine , I'm running it on python2.7 , maybe that's why
I don't have the code right now , (on another computer , so till monday , if you would still need it )

when you changed the masks to be in RGB , did you make sure the 2 colors that are in in RGB mask are the ones you provided in the hypes ? aside from that I cannot think of anything else ...

@lemhell
Copy link

lemhell commented Apr 8, 2017

@Bendidi
Thank you for your answers.
I installed everything for Python 2.7 and it started to work, even with commentjson.

@lemhell
Copy link

lemhell commented Apr 8, 2017

I started training and MaxF1 started near 17, now it is near 26 after 4500 steps (out of 12000) and sometimes jumps around. Is it ok or should I do something?
Also, there is a parameter called weight_loss and it is always the same: 3.62.

@KKayak
Copy link

KKayak commented May 14, 2018

@lemhell how to comment line 123

@lemhell
Copy link

lemhell commented May 14, 2018

@1464256670
If I recall correctly, I downloaded this repository and commented the problematic line (123) in the train.py script (using # at the start of this line).
However, it did not resolve the problem and I switched to Python 2.7. After that, the script started to work.

@KKayak
Copy link

KKayak commented May 14, 2018

@lemhell by the way,thanks for your replyment,another question:to train my own data,all what i did is creating my train.txt and val.txt ,is that enough ,anything else to do?

@KKayak
Copy link

KKayak commented May 14, 2018

@lemhell is only running train.py enough,any other .py should i run?

@lemhell
Copy link

lemhell commented May 14, 2018

@1464256670
You can probably find some info here.

@YongKun-Liu
Copy link

objective function also need to change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants