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

Variation of line thickness #4

Open
WANGEOGEO opened this issue Nov 22, 2021 · 4 comments
Open

Variation of line thickness #4

WANGEOGEO opened this issue Nov 22, 2021 · 4 comments

Comments

@WANGEOGEO
Copy link

Hi,

After reading through the code, I found that there is no specific pipeline showing how the 'thickness' of lines drawing through points are varied during training. To my understanding, there will be 5 levels of thickness: 600, 260, 140, 80 and 40. As the training goes on, when a specific iteration number is reached, the thickness will be changed to next level (from 600->260 directly for example). Is my understanding correct?

@Charch-630
Copy link
Owner

We have only released the demo and the evaluation code. Most of the training part including the Progressive Trimap Deformation has been removed in this version. But the principle is simple, and you can try to implement is yourself.

You misunderstand about the variation of the thickness of the scribbles. In Figure 3 in the paper, I just want to show what the guidance map looks like with different thickness. In fact, the change of thickness is a smooth process. Here is the relationship between thickness and training step. Descriptions are in 4.1 in the paper and thickness==40 when step >530000.

2021-11-23 11-32-26屏幕截图

@WANGEOGEO
Copy link
Author

Ah, I see. So the core Idea is to find an exponential function to adjust my thickness. Actually while implementing the Trimap Deformation, I found it requires a pretty long time to generate the deformed trimap for training, which includes cubic line fitting and curve plotting. Is this a normal condition? Since I am currently plotting curves by plotting circles along it, I think my implementation might be wrong.

@Charch-630
Copy link
Owner

My training speed is about 5s~8s/10iterations. And I use two 2080Ti with batchsize 5 on each one. It was trained on our lab's server.
image

I pick 3 points to do curve fitting each time, then I use np.polyfit(x, y, 3)and np.poly1d() to generate the curve function. After that I pick 10 equally spaced points on the curve, note that the first and the last points are the first and the last sampled points that are used to generate the curve function. And I use cv2.line to link the 10 points.

@WANGEOGEO
Copy link
Author

After some experiments, I found that my implementation of drawing curves (draw circles) achieves similar performance as drawing lines. But, I found that the main bottleneck of Trimap Deformation in my case was sampling points in FG/BG. I found it quite time-consuming to only use np.where to generate points, and trying to figure out a more efficient implementation for my case. Thanks for showing me the stats and approaches!

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