Ethan-Tseng / Neural_Nano-Optics

Repository for "Neural Nano-Optics for High-quality Thin Lens Imaging"
Boost Software License 1.0
73 stars 30 forks source link

The best loss weighting coefficients #3

Open longzw001116 opened 1 year ago

longzw001116 commented 1 year ago

Since thess is no description about the best loss weighting coefficients {λ1, λperc, λgrad} used in training, I wonder whether it is the value set in the ”run_train.sh“ that λ1=1.0, λperc=0.1 and λgrad=0.0.

longzw001116 commented 1 year ago

In solver.py line 75-78:

 image_width = params['f'] * np.tan(20.0 * np.pi / 180.0) * np.sqrt(2) 
 image_width = image_width * params['magnification'] / params['sensor_pixel']
 params['image_width'] = np.int(2*dim * np.ceil(image_width / (2*dim) ))
  1. why do we times the np.sqrt(2)? In my opinion, it should be 2.
  2. why params['magnification'] = 8.1 instead of 10 indicated in Supplementary Figure 7?
longzw001116 commented 1 year ago

I think i know why np.sqrt(2). The FOV=40° maybe refer to diagonal FOV.

In solver.py line 75-78:

 image_width = params['f'] * np.tan(20.0 * np.pi / 180.0) * np.sqrt(2) 
 image_width = image_width * params['magnification'] / params['sensor_pixel']
 params['image_width'] = np.int(2*dim * np.ceil(image_width / (2*dim) ))
  1. why do we times the np.sqrt(2)? In my opinion, it should be 2.
  2. why params['magnification'] = 8.1 instead of 10 indicated in Supplementary Figure 7?
Ethan-Tseng commented 1 year ago

Since thess is no description about the best loss weighting coefficients {λ1, λperc, λgrad} used in training, I wonder whether it is the value set in the ”run_train.sh“ that λ1=1.0, λperc=0.1 and λgrad=0.0.

Hi, thanks for your interest in our work and apologies for the late reply. I recommend playing around with the loss weighting as I did not find any particular setting to be a clear "best". Nevertheless, I recommend putting most of the weight into λ1 and putting lesser weight into the other coefficients.

Ethan-Tseng commented 1 year ago

I think i know why np.sqrt(2). The FOV=40° maybe refer to diagonal FOV.

In solver.py line 75-78:

 image_width = params['f'] * np.tan(20.0 * np.pi / 180.0) * np.sqrt(2) 
 image_width = image_width * params['magnification'] / params['sensor_pixel']
 params['image_width'] = np.int(2*dim * np.ceil(image_width / (2*dim) ))
  1. why do we times the np.sqrt(2)? In my opinion, it should be 2.
  2. why params['magnification'] = 8.1 instead of 10 indicated in Supplementary Figure 7?
  1. You are correct. The quoted FOV refers to the diagonal FOV.
  2. I adjusted the magnification parameter when finetuning for the real captures. This was done to compensate for slight misalignments in the hardware setup. This can be ignored during the design optimization stage.