navervision / mlsd

Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection" (AAAI 2022 Oral)
Apache License 2.0
521 stars 79 forks source link

Convert to tensorflowjs #12

Open dongngm opened 2 years ago

dongngm commented 2 years ago

Hi, Thanks for your great work.

Could you please upload the saved model/keras model so that it could be converted to tensorflowjs model? I am working on a web application.

Thank you in advance.

geonm commented 2 years ago

Hi.

Glad to hear that.

Do you want ckpt files?

dongngm commented 2 years ago

Yes, it would be very helpful. Thanks a lot @geonm

geonm commented 2 years ago

No problem. 😄

I will share ckpt files after checking the code ASAP.

geonm commented 2 years ago

I added ckpt files. (For now, only M-LSD 512 large model is uploaded)

Please refer to https://github.com/navervision/mlsd/tree/master/ckpt_models/M-LSD_512_large

If you want to check the code that converts the ckpt files into a tflite model, please refer to https://github.com/navervision/mlsd#how-to-convert-ckpt-models-to-tflite-models

dongngm commented 2 years ago

big thanks @geonm

dongngm commented 2 years ago

sorry for bothering you again @geonm . I've tested the converted tensorflowjs model and it seems that the response time is not good enough for my real-time application. Could you please also upload the tiny with lower resolution model version? Thanks a lot.

geonm commented 2 years ago

Of course, I can provide all ckpt files.

However, my computing server used in this project will not be available until next Monday (10/25/2021 KST) due to internal circumstances.

Is it urgent?

BTW, what was the FPS of your application with M-LSD 512 large?

With desktop CPU, M-LSD 512 large (ckpt file) was fast enough for me.

NOTE: In this repository, I coded easy-to-use demo using only tflite models. Even it works on desktop CPU, it is slower than mobile devices. Please refer to https://stackoverflow.com/questions/54093424/why-is-tensorflow-lite-slower-than-tensorflow-on-desktop

dongngm commented 2 years ago

Next Monday is fine. Thank you @geonm I am having like 700ms for a single image prediction with tensorflow js on my desktop (quite not comparable to what you've got with tflite models, don't know tensorflow js could be that slower). Maybe trying smaller model, lower resolution may help

dongngm commented 2 years ago

hi, any update on this @geonm?

geonm commented 2 years ago

I got the machine and now I'm testing.

geonm commented 2 years ago

I added all ckpt files.

M-LSD 512 large, M-LSD 320 large M-LSD 512 tiny, M-LSD 320 tiny

Please refer to https://github.com/navervision/mlsd/tree/master/ckpt_models

If you want to check the code that converts the ckpt files into a tflite model, please refer to https://github.com/navervision/mlsd#how-to-convert-ckpt-models-to-tflite-models

@dongngm Could you make your tensorflow JS codes public?

It will be very helpful to anyone new to tensorflow JS with M-LSD.

dongngm commented 2 years ago

thanks @geonm After testing is ok I will make PR for tensorfow JS code

randhirjhadw commented 1 year ago

Hello @dongngm

I am trying to convert the model to tenserflowjs but it's not working Can you help to convert the ckpt model to tenserflowjs?

Thank you.