hanish3464 / WORD-pytorch

Webtoon Object Recognition and Detection(WORD)
41 stars 8 forks source link

bubble, char #6

Closed sksmswldlsdl closed 1 year ago

sksmswldlsdl commented 1 year ago

Hi. I'm thankful for your open code. I'm having a hard time because of a problem while running the code. I add test image files and run the demo.py, but bubble and char images are not generated, and only the cut and demo images are generated. Is there anything I need to set up when I run the demo.py? Or do I need to learn dataset separately to run demo.py?

hanish3464 commented 1 year ago

First of all, thank you for your interest in my project. Please understand that it is difficult to answer in detail because I can't remember well because it was 3 years ago.

Did you check the return value of the code to make sure that speech bubbles are not generated?

I think there are two possible causes.

The first is that the height of your input image is too long. there was resizing code for making input size of model appropriate. if the width or height is relatively too large, distortion of the image may occur. As a result, the model may not be able to detect the speech bubble well. Therefore, Try running it again with args.large_scale =True Please check width and height of your image is similar ratio before passing speech bubble detector.

Second, checkpoint of the model may not have been loaded. Test easy sample that the model can easily detect, such as a normal speech bubble and similar proportions of size (512x512). If the model did not detect well, I think the model would not have been loaded normally.

If you could describe the problem in more detail, it would be helpful to give you a detailed answer.

Thank you.

sksmswldlsdl commented 1 year ago

Thank you. I've been checked two causes that you advices, but the result is same. 😭 And I changed cls (bubble prediction threshold) 0.095 to 0.5, 4 bubbles are generated, but chars, ocr.txt, spaces.txt are still not generated.

hanish3464 commented 1 year ago

First of all, you need to check whether chars is detected well. if chars isn't detected well, ocr.txt and spaces.txt is not generated. (because ocr and space is from chars results)

In order to check whether char has been generated normally, it is necessary to intensively check this code part

and

args.DRAWTXT 와 args.DRAWLINK is a code for debugging. After you set them all to True, you need to check if model can draw text line well on your bubble.

Finally,

This project may help you understand the deep learning pipeline for translating webtoons, and you can get not bad results. However, it may be helpful for your work to replace it with a newer module since each learned module is not the latest version.

but, I don't know if there is a model that can be good at korean OCR .. 😭

sksmswldlsdl commented 1 year ago

oh,,,, Ok. thank you. I'll try that.

Can I ask one more question? When I run 'Loading weights from checkpoint: speech-bubble-detect.pt' in demo.py, it takes more than ten minutes. I don't know if it's the way it is or if it happens to me. I set running in gpu, but when I run demo.py, It takes too much time.

hanish3464 commented 1 year ago

I don't know .. 😭 but I've had a similar problem.

import torch
import time

test_tensor = torch.zeros(512, 512, 3)
st = time.time()
test_tensor = test.tensor.cuda() # it take a long time?
ed = time.time()
print(f'elapse : {ed - st}')

When you run the code above, does it take more than 5-10 seconds?

sksmswldlsdl commented 1 year ago

yes, it takes more than 10-15 minutes.... 🥲

hanish3464 commented 1 year ago

I think you need to change the pytorch version...🥲 you will probably solve the speed problem If you reinstall the pytorch that fits the cuda version.

The important thing is whether the bubble detector is compatible with the pytorch version you changed. The bubble detector basically used the fast-rcnn model. But I'm not sure if the official report supports pytorch-1.0 higher.

Therefore, if the bubble detector does not work properly on your newly installed pytorch version, it would be better to replace the bubble detector using the following model of the repo.

sksmswldlsdl commented 1 year ago

Ok. I'll try that. Thank you so much for talking with me for a long time 😭 I'm sure it's a cool code 👍