itijyou / ademxapp

Code for https://arxiv.org/abs/1611.10080
Other
340 stars 98 forks source link

How to run the semantic segmentation on my own images? #34

Closed Tetsujinfr closed 7 years ago

Tetsujinfr commented 7 years ago

hi so I did succesfully run the perf test on Pascal VOC with: python issegm/voc.py --data-root data/VOCdevkit --output output --phase val --weights models/voc_rna-a1_cls21_s8_ep-0001.params --split val --test-scales 500 --test-flipping --gpus 0`

Now I only want to use the pre-trained model and test it on non-VOC images, so on my own images, but it seems that voc.py is highly specific to the voc dataset.

Can I use voc.py and some flag to run it on my own images or do I need to heavily modify the code so that it does not look for segmentationClass mask images from voc etc?

thanks Tets

Tetsujinfr commented 7 years ago

ok so I managed to run it on my own images but I have some large staircase type of effects, not sure why? is it due to the pre-trained models which has run on low res images and consequently if I run on high resolution images some interpolation is done to upscale the segmentation? Do I need to tweak the code to get better results or this is a model limitation ? (the below is a person standing and his legs do not have such a staircase profil) out-0416

gnobitab commented 7 years ago

Hi, Tetsujinfr. Thanks for your share. May I ask how I can get a segmented image on my own image like the picture you posted?

gnobitab commented 7 years ago

@Tetsujinfr

Tetsujinfr commented 7 years ago

Hi sure. Let me post the bits and pieces I did modify later today (can not right now). Warning: this is a quick and dirty hack of the code bit it works to test on new data. Will post the code and and an example of th command line.

gnobitab commented 7 years ago

Thanks a lot.

Tetsujinfr commented 7 years ago

ok, I attach the modified file data.py and the modified voc.py (voctets.py here). Basically I de-acivated the part which is doing the validation scoring in the voc file. So put your images into a folder, say ademxapp/myInputImages, then go into this folcer and do a "ls *.jpg

myInputImages.lst" to generate the file containing the images inventory to process. Then call voctets.py as sudo with --data-root /myInputImages and it should work. An example: python issegm/tetsvoc.py --data-root data/myPNGImages --output outputTets --phase val --weights models/voc_rna-a1_cls21_s8_ep-0001.params --split val --test-scales 720 --test-flipping --gpus 0

(I did attach the py files as .txt so that I can attach them but please remove the .txt extension) Hope it helps.

I did run the model over a few video, have a look at my youtube channel, I will post some results soon: https://www.youtube.com/channel/UCZUuytmk4SbmKVDgqhq24Kw Some hint: img_5425 img_8793

Tets

data.py.txt tetsvoc.py.txt

gnobitab commented 7 years ago

Thanks for your share. Great help.

Tetsujinfr commented 7 years ago

I will close this issue in the next couple days if no more question.

jeremy-cv commented 6 years ago

Hi Testsujinfr,

thanks for your instructions. Did you finally find out why there is this "staircase effect" ?

Thank you

Tetsujinfr commented 6 years ago

Not fully although I suspect it is due to the resolution of the training dataset of the model, which I think take 224x224 pixel input images. So ultimately for large hi res image, the model is going to interpolate somehow, and it seems it is doing that is a squarry way as a default. I did not dig it further. I liked this project, one of the best results I have seen on segmentation so far, but I am not an expert in the field.

johnnylu305 commented 4 years ago

Although the issue has been closed, if you want to train/test the network with a personal dataset, please edit the "train.lst/val.lst" in the "issegm/data/voc/" and replace the images in the "data/VOCdevkit/VOC2012/JPEGImages" and "data/VOCdevkit/VOC2012/SegmentationClass" with yours. .