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

Regarding the execution time and to detect only the desired labels. #3

Open
JoseAntonyS opened this issue May 21, 2020 · 7 comments
Open

Comments

@JoseAntonyS
Copy link

Hi minar, This is really supercool. I was very worried about the speed from the original repo's code. Hope this will be faster than that. Also how do i set only the desired labels to be predicted and segemented. For eg, the older model tries to segment the all the 20 attributes in my test image, where it confuses with the subjects and segments inappropriately. I need to detect upper clothes, pants, hands, legs and head. If there are any solutions to this, please suggest. Thanks in advance.

@minar09
Copy link
Owner

minar09 commented May 21, 2020

Hi @JoseAntonyS, thanks for your comment. Although I did not modify the original repo that much, execution time is not that bad, I needed to add the visualization part only. Anyway, I think the model is already trained to detect 20 labels. So, either you need to train a new model with your specific labeled dataset, or you can simply change the labels that you don't need to zero after detecting with the pretrained model.
For example, you can do something like this:

parsing_, scores = sess.run([pred_all, pred_scores])
 
parsing_[parsing_==1] = 0  # for Hat
 
parsing_[parsing_==2] = 0  # for Hair
 
parsing_[parsing_==3] = 0  # for Glove

...

I am not sure if this code will work exactly, you need to do some dimension check and something. After you remove the un-needed labels, you can also re-label your specific labels same way. Hope that helps.

@JoseAntonyS
Copy link
Author

I appreciate your kind response. will check this.

Also, I found there is a bug in the code , in the imagereader.py. please look into it. line160. At first, I was unable to run the code, after changing it to "images.append(data_dir + "" + image)" . the code was error free.

@minar09
Copy link
Owner

minar09 commented May 21, 2020

I guess that's their dataset format in CIHP, so they assume that there is a "image" folder by default. Glad that it worked for you.

@JoseAntonyS
Copy link
Author

Hi Minar, I am again stuck with another issue. I can only run the test_pgn.py using cpu. When I set the environment to '0' which refers to my GPU, the execution gets interrupted and i get the following error. Did you come across any such issue?
(1) Resource exhausted: OOM when allocating tensor with shape[2,1024,158,89] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [[{{node res4a_branch1_5/Conv2D}}]] Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info. 0 successful operations. 0 derived errors ignored.

@JoseAntonyS JoseAntonyS reopened this Jun 5, 2020
@minar09
Copy link
Owner

minar09 commented Jun 5, 2020

Hi @JoseAntonyS , yes this is out of memory issue. Usually it resolves if you make your batch size smaller. You can also include all your available gpus in visible cuda devices as in 0,1,2,3 (if there are 4 gpus for example, can be less also). Hope that helps. Thanks.

@JoseAntonyS
Copy link
Author

Yeah Minar, I had pointed the gpu in the code os.environ["CUDA_VISIBLE_DEVICES"]="0,1" but still the same error is occurs. I have reduced the batch size and now it is considerably faster than earlier attempts with CPU. I wish if it runs on GPU, execution would be faster.

@minar09
Copy link
Owner

minar09 commented Jun 6, 2020

Is it running now? You can make the batch size really small e.g. 1 or 2, if it doesn't. GPUs are supposed to make program faster, but there are limits how much computations can be done in GPU.

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

2 participants