singer-yang / Aberration-Aware-Depth-from-Focus

[ICCP & TPAMI 2023] Official code for the paper "Aberration-Aware Depth-from-Focus"
https://vccimaging.org/Publications/Yang2023AATDfF/
21 stars 8 forks source link

How to obtain the pretrained pkls for dfvnet and aifnet #6

Open dusk1037 opened 8 months ago

singer-yang commented 8 months ago

Hello dusk1037,

Thanks a lot for your interest! You can run the training code to train your own models. It is very easy and straightforward, and I believe you can get a deeper understanding by doing this.

For this project, the aberration-aware training (AAT) method is more important. You should not expect the model to function for different lenses since the aberrations are different! :-)

Best, Xinge

dusk1037 commented 8 months ago

Thank you for replying, does that mean that the ungiven pretrained models labeled as "dfvnet_stack8_480x640.pkl" and "aifnet_stack8_480x640.pkl" can be acquired by following the steps and accessing to the git repos given in the refrenced articles [22]"Deep depth from focus with diffrentisl focus volume" and [20]"Bridging unsupervised and supervised depth from focus via all-in-focus supervision"?

singer-yang commented 8 months ago

No. The model weights are highly related to the lens and the pixel size, which affect the 4D PSFs. That also means if you change the lens or the camera sensor, the pretrained model will not work. The pretrained weights in [20] and [22] consider lenses without any aberration, therefore will not work for the RF50mm lens we are using.

I will upload our pretrained weights these days. Or you can run the training code to train the models by yourself. :-)

dusk1037 commented 7 months ago

Huge thanks for replying, Frankly speaking, I'm currently a college freshman trying to learn more about Computer Vision and Image Processing. I would like to inquire about what does the "training code" in your former comment refer to?

singer-yang commented 7 months ago

Hello dusk1037,

You can run python 2_aber_aware_dff_aif.py which will train a depth-from-focus network model. The model is so-called aberration-aware because it can learn to extract depth information at the existence of aberrations. I assume you have experience in training a deep network, otherwise, you may check this tutorial Dive into deep learning to start.

If you have any questions, please feel free to ask. Hope you enjoy the research of deep learning and computational imaging!!

dusk1037 commented 7 months ago

I happened to encounter a Runtime error:CUDA out of memory when I tried to run the file "2_aber_aware_dff_aif.py", while the original traceback leads me to line 370 in ./dff/Aifnet.py, which consists of a annotation that says "FIXME: bug here", can it be resolved?

singer-yang commented 7 months ago

Hello,

This is a bug coming from the original AiFNet architecture. Reducing the stack size should resolve it.

dusk1037 commented 7 months ago

Thank you for your timely replying!