Click on a line that starts with a "<code>+</code>" to see the C code that Cython generated for it.
</p>
<p>Raw output: <ahref="lcn.c">lcn.c</a></p>
<divclass="cython"><preclass="cython line score-16"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">01</span>: <spanclass="k">import</span><spanclass="nn">numpy</span><spanclass="k">as</span><spanclass="nn">np</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">02</span>: <spanclass="k">cimport</span><spanclass="nn">cython</span></pre>
</pre>
<preclass="cython line score-0"> <spanclass="">02</span>: <spanclass="k">cimport</span><spanclass="nn">cython</span></pre>
<preclass="cython line score-0"> <spanclass="">03</span>: </pre>
<preclass="cython line score-0"> <spanclass="">04</span>: <spanclass="c"># use c square root function</span></pre>
<preclass="cython line score-0"> <spanclass="">05</span>: <spanclass="k">cdef</span><spanclass="kr">extern</span><spanclass="k">from</span><spanclass="s">"math.h"</span><spanclass="p">:</span></pre>
<preclass="cython line score-0"> <spanclass="">06</span>: <spanclass="nb">float</span><spanclass="n">sqrt</span><spanclass="p">(</span><spanclass="nb">float</span><spanclass="n">x</span><spanclass="p">)</span></pre>
<preclass="cython line score-0"> <spanclass="">05</span>: <spanclass="k">cdef</span><span
<preclass="cython line score-0"> <spanclass="">07</span>: </pre>
<preclass="cython line score-0"> <spanclass="">08</span>: <spanclass="nd">@cython</span><spanclass="o">.</span><spanclass="n">boundscheck</span><spanclass="p">(</span><spanclass="bp">False</span><spanclass="p">)</span></pre>
<preclass="cython line score-0"> <spanclass="">09</span>: <spanclass="nd">@cython</span><spanclass="o">.</span><spanclass="n">wraparound</span><spanclass="p">(</span><spanclass="bp">False</span><spanclass="p">)</span></pre>
<preclass="cython line score-0"> <spanclass="">10</span>: <spanclass="nd">@cython</span><spanclass="o">.</span><spanclass="n">cdivision</span><spanclass="p">(</span><spanclass="bp">True</span><spanclass="p">)</span></pre>
<preclass="cython line score-0"> <spanclass="">08</span>: <spanclass="nd">@cython</span><span
<preclass="cython line score-0"> <spanclass="">11</span>: </pre>
<preclass="cython line score-0"> <spanclass="">12</span>: <spanclass="c"># 3 parameters:</span></pre>
<preclass="cython line score-0"> <spanclass="">13</span>: <spanclass="c"># - float image</span></pre>
<preclass="cython line score-0"> <spanclass="">14</span>: <spanclass="c"># - kernel size (actually this is the radius, kernel is 2*k+1)</span></pre>
<preclass="cython line score-0"> <spanclass="">15</span>: <spanclass="c"># - small constant epsilon that is used to avoid division by zero</span></pre>
<preclass="cython line score-67"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">16</span>: <spanclass="k">def</span><spanclass="nf">normalize</span><spanclass="p">(</span><spanclass="nb">float</span><spanclass="p">[:,</span><spanclass="p">:]</span><spanclass="n">img</span><spanclass="p">,</span><spanclass="nb">int</span><spanclass="n">kernel_size</span><spanclass="o">=</span><spanclass="mf">4</span><spanclass="p">,</span><spanclass="nb">float</span><spanclass="n">epsilon</span><spanclass="o">=</span><spanclass="mf">0.01</span><spanclass="p">):</span></pre>
class='error_goto'> if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 16, __pyx_L1_error)</span>
</pre>
<preclass="cython line score-0"> <spanclass="">17</span>: </pre>
<preclass="cython line score-0"> <spanclass="">18</span>: <spanclass="c"># image dimensions</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">19</span>: <spanclass="k">cdef</span><spanclass="kt">Py_ssize_t</span><spanclass="nf">M</span><spanclass="o">=</span><spanclass="n">img</span><spanclass="o">.</span><spanclass="n">shape</span><spanclass="p">[</span><spanclass="mf">0</span><spanclass="p">]</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">20</span>: <spanclass="k">cdef</span><spanclass="kt">Py_ssize_t</span><spanclass="nf">N</span><spanclass="o">=</span><spanclass="n">img</span><spanclass="o">.</span><spanclass="n">shape</span><spanclass="p">[</span><spanclass="mf">1</span><spanclass="p">]</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">21</span>: </pre>
</pre>
<preclass="cython line score-0"> <spanclass="">21</span>: </pre>
<preclass="cython line score-0"> <spanclass="">22</span>: <spanclass="c"># create outputs and output views</span></pre>
<preclass="cython line score-46"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">23</span>: <spanclass="n">img_lcn</span><spanclass="o">=</span><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">zeros</span><spanclass="p">((</span><spanclass="n">M</span><spanclass="p">,</span><spanclass="n">N</span><spanclass="p">),</span><spanclass="n">dtype</span><spanclass="o">=</span><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">float32</span><spanclass="p">)</span></pre>
<preclass='cython code score-46 '><spanclass='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_np);<spanclass='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)</span>
</pre><preclass="cython line score-46"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">24</span>: <spanclass="n">img_std</span><spanclass="o">=</span><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">zeros</span><spanclass="p">((</span><spanclass="n">M</span><spanclass="p">,</span><spanclass="n">N</span><spanclass="p">),</span><spanclass="n">dtype</span><spanclass="o">=</span><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">float32</span><spanclass="p">)</span></pre>
<preclass='cython code score-46 '><spanclass='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_5, __pyx_n_s_np);<spanclass='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)</span>
</pre><preclass="cython line score-2"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">25</span>: <spanclass="k">cdef</span><spanclass="kt">float</span>[<spanclass="p">:,</span><spanclass="p">:]</span><spanclass="n">img_lcn_view</span><spanclass="o">=</span><spanclass="n">img_lcn</span></pre>
class='error_goto'> if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
__pyx_v_img_lcn_view = __pyx_t_6;
__pyx_t_6.memview = NULL;
__pyx_t_6.data = NULL;
</pre><preclass="cython line score-2"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">26</span>: <spanclass="k">cdef</span><spanclass="kt">float</span>[<spanclass="p">:,</span><spanclass="p">:]</span><spanclass="n">img_std_view</span><spanclass="o">=</span><spanclass="n">img_std</span></pre>
class='error_goto'> if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 26, __pyx_L1_error)</span>
__pyx_v_img_std_view = __pyx_t_6;
__pyx_t_6.memview = NULL;
__pyx_t_6.data = NULL;
</pre><preclass="cython line score-0"> <spanclass="">27</span>: </pre>
</pre>
<preclass="cython line score-0"> <spanclass="">27</span>: </pre>
<preclass="cython line score-0"> <spanclass="">28</span>: <spanclass="c"># temporary c variables</span></pre>
<preclass="cython line score-0"> <spanclass="">29</span>: <spanclass="k">cdef</span><spanclass="kt">float</span><spanclass="nf">tmp</span><spanclass="p">,</span><spanclass="nf">mean</span><spanclass="p">,</span><spanclass="nf">stddev</span></pre>
<preclass="cython line score-0"> <spanclass="">30</span>: <spanclass="k">cdef</span><spanclass="kt">Py_ssize_t</span><spanclass="nf">m</span><spanclass="p">,</span><spanclass="nf">n</span><spanclass="p">,</span><spanclass="nf">i</span><spanclass="p">,</span><spanclass="nf">j</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">31</span>: <spanclass="k">cdef</span><spanclass="kt">Py_ssize_t</span><spanclass="nf">ks</span><spanclass="o">=</span><spanclass="n">kernel_size</span></pre>
<preclass="cython line score-0"> <spanclass="">29</span>: <spanclass="k">cdef</span><spanclass="kt">float</span><span
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">32</span>: <spanclass="k">cdef</span><spanclass="kt">float</span><spanclass="nf">eps</span><spanclass="o">=</span><spanclass="n">epsilon</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">33</span>: <spanclass="k">cdef</span><spanclass="kt">float</span><spanclass="nf">num</span><spanclass="o">=</span><spanclass="p">(</span><spanclass="n">ks</span><spanclass="o">*</span><spanclass="mf">2</span><spanclass="o">+</span><spanclass="mf">1</span><spanclass="p">)</span><spanclass="o">**</span><spanclass="mf">2</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">34</span>: </pre>
<preclass="cython line score-0"> <spanclass="">35</span>: <spanclass="c"># for all pixels do</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">36</span>: <spanclass="k">for</span><spanclass="n">m</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">M</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">):</span></pre>
</pre>
<preclass="cython line score-0"> <spanclass="">34</span>: </pre>
<preclass="cython line score-0"> <spanclass="">35</span>: <span
for (__pyx_t_9 = __pyx_v_ks; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
__pyx_v_m = __pyx_t_9;
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">37</span>: <spanclass="k">for</span><spanclass="n">n</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">N</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">):</span></pre>
for (__pyx_t_12 = __pyx_v_ks; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
__pyx_v_n = __pyx_t_12;
</pre><preclass="cython line score-0"> <spanclass="">38</span>: </pre>
</pre>
<preclass="cython line score-0"> <spanclass="">38</span>: </pre>
<preclass="cython line score-0"> <spanclass="">39</span>: <spanclass="c"># calculate mean</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">40</span>: <spanclass="n">mean</span><spanclass="o">=</span><spanclass="mf">0</span><spanclass="p">;</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">41</span>: <spanclass="k">for</span><spanclass="n">i</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">ks</span><spanclass="o">+</span><spanclass="mf">1</span><spanclass="p">):</span></pre>
for (__pyx_t_15 = (-__pyx_v_ks); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
__pyx_v_i = __pyx_t_15;
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">42</span>: <spanclass="k">for</span><spanclass="n">j</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">ks</span><spanclass="o">+</span><spanclass="mf">1</span><spanclass="p">):</span></pre>
for (__pyx_t_18 = (-__pyx_v_ks); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
__pyx_v_j = __pyx_t_18;
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">43</span>: <spanclass="n">mean</span><spanclass="o">+=</span><spanclass="n">img</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="o">+</span><spanclass="n">i</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="o">+</span><spanclass="n">j</span><spanclass="p">]</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">44</span>: <spanclass="n">mean</span><spanclass="o">=</span><spanclass="n">mean</span><spanclass="o">/</span><spanclass="n">num</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">45</span>: </pre>
<preclass="cython line score-0"> <spanclass="">46</span>: <spanclass="c"># calculate std dev</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">47</span>: <spanclass="n">stddev</span><spanclass="o">=</span><spanclass="mf">0</span><spanclass="p">;</span></pre>
</pre>
<preclass="cython line score-0"> <spanclass="">45</span>: </pre>
<preclass="cython line score-0"> <spanclass="">46</span>: <span
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">48</span>: <spanclass="k">for</span><spanclass="n">i</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">ks</span><spanclass="o">+</span><spanclass="mf">1</span><spanclass="p">):</span></pre>
for (__pyx_t_15 = (-__pyx_v_ks); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
__pyx_v_i = __pyx_t_15;
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">49</span>: <spanclass="k">for</span><spanclass="n">j</span><spanclass="ow">in</span><spanclass="nb">range</span><spanclass="p">(</span><spanclass="o">-</span><spanclass="n">ks</span><spanclass="p">,</span><spanclass="n">ks</span><spanclass="o">+</span><spanclass="mf">1</span><spanclass="p">):</span></pre>
for (__pyx_t_18 = (-__pyx_v_ks); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
__pyx_v_j = __pyx_t_18;
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">50</span>: <spanclass="n">stddev</span><spanclass="o">=</span><spanclass="n">stddev</span><spanclass="o">+</span><spanclass="p">(</span><spanclass="n">img</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="o">+</span><spanclass="n">i</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="o">+</span><spanclass="n">j</span><spanclass="p">]</span><spanclass="o">-</span><spanclass="n">mean</span><spanclass="p">)</span><spanclass="o">*</span><spanclass="p">(</span><spanclass="n">img</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="o">+</span><spanclass="n">i</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="o">+</span><spanclass="n">j</span><spanclass="p">]</span><spanclass="o">-</span><spanclass="n">mean</span><spanclass="p">)</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">51</span>: <spanclass="n">stddev</span><spanclass="o">=</span><spanclass="n">sqrt</span><spanclass="p">(</span><spanclass="n">stddev</span><spanclass="o">/</span><spanclass="n">num</span><spanclass="p">)</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">52</span>: </pre>
</pre>
<preclass="cython line score-0"> <spanclass="">52</span>: </pre>
<preclass="cython line score-0"> <spanclass="">53</span>: <spanclass="c"># compute normalized image (add epsilon) and std dev image</span></pre>
<preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">54</span>: <spanclass="n">img_lcn_view</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="p">]</span><spanclass="o">=</span><spanclass="p">(</span><spanclass="n">img</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="p">]</span><spanclass="o">-</span><spanclass="n">mean</span><spanclass="p">)</span><spanclass="o">/</span><spanclass="p">(</span><spanclass="n">stddev</span><spanclass="o">+</span><spanclass="n">eps</span><spanclass="p">)</span></pre>
</pre><preclass="cython line score-0"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">55</span>: <spanclass="n">img_std_view</span><spanclass="p">[</span><spanclass="n">m</span><spanclass="p">,</span><spanclass="n">n</span><spanclass="p">]</span><spanclass="o">=</span><spanclass="n">stddev</span></pre>
</pre><preclass="cython line score-0"> <spanclass="">56</span>: </pre>
</pre>
<preclass="cython line score-0"> <spanclass="">56</span>: </pre>
<preclass="cython line score-0"> <spanclass="">57</span>: <spanclass="c"># return both</span></pre>
<preclass="cython line score-10"onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<spanclass="">58</span>: <spanclass="k">return</span><spanclass="n">img_lcn</span><spanclass="p">,</span><spanclass="n">img_std</span></pre>
ax=plt.subplot(3,3,7);plt.imshow(im[0],vmin=im.min(),vmax=im.max(),cmap='gray');plt.xticks([]);plt.yticks([]);ax.set_title(f'F0 IR input {im[0].mean():.5f}/{im[0].std():.5f}')
ax.set_title(f'F0 IR input {im[0].mean():.5f}/{im[0].std():.5f}')
ifes.shape[0]>=2:
ax=plt.subplot(3,3,8);plt.imshow(im[1],vmin=im.min(),vmax=im.max(),cmap='gray');plt.xticks([]);plt.yticks([]);ax.set_title(f'F1 IR input {im[1].mean():.5f}/{im[1].std():.5f}')
@ -24,40 +26,45 @@ If you find this code useful for your research, please cite
}
```
## Dependencies
The network training/evaluation code is based on `Pytorch`.
```
PyTorch>=1.1
Cuda>=10.0
```
Updated on 07.06.2021: The code is now compatible with the latest Pytorch version (1.8).
The other python packages can be installed with `anaconda`:
```
conda install --file requirements.txt
```
### Structured Light Renderer
To train and evaluate our method in a controlled setting, we implemented an structured light renderer.
It can be used to render a virtual scene (arbitrary triangle mesh) with the structured light pattern projected from a customizable projector location.
To build it, first make sure the correct `CUDA_LIBRARY_PATH` is set in `config.json`.
Afterwards, the renderer can be build by running `make` within the `renderer` directory.
To train and evaluate our method in a controlled setting, we implemented an structured light renderer. It can be used to
render a virtual scene (arbitrary triangle mesh) with the structured light pattern projected from a customizable
projector location. To build it, first make sure the correct `CUDA_LIBRARY_PATH` is set in `config.json`. Afterwards,
the renderer can be build by running `make` within the `renderer` directory.
### PyTorch Extensions
The network training/evaluation code is based on `PyTorch`.
We implemented some custom layers that need to be built in the `torchext` directory.
Simply change into this directory and run
The network training/evaluation code is based on `PyTorch`. We implemented some custom layers that need to be built in
the `torchext` directory. Simply change into this directory and run
```
python setup.py build_ext --inplace
```
### Baseline HyperDepth
As baseline we partially re-implemented the random forest based method [HyperDepth](http://openaccess.thecvf.com/content_cvpr_2016/papers/Fanello_HyperDepth_Learning_Depth_CVPR_2016_paper.pdf).
The code resided in the `hyperdepth` directory and is implemented in `C++11` with a Python wrapper written in `Cython`.
To build it change into the directory and run
As baseline we partially re-implemented the random forest based
To create synthetic data and save it locally, download [ShapeNet V2](https://www.shapenet.org/) and correct `SHAPENET_ROOT` in `config.json`. Then the data can be generated and saved to `DATA_ROOT` in `config.json` by running
To create synthetic data and save it locally, download [ShapeNet V2](https://www.shapenet.org/) and
correct `SHAPENET_ROOT` in `config.json`. Then the data can be generated and saved to `DATA_ROOT` in `config.json` by
running
```
./create_syn_data.sh
```
If you are only interested in evaluating our pre-trained model, [here (3.7G)](https://s3.eu-central-1.amazonaws.com/avg-projects/connecting_the_dots/val_data.zip) is a validation set that contains a small amount of images.
If you are only interested in evaluating our pre-trained
model, [here (3.7G)](https://s3.eu-central-1.amazonaws.com/avg-projects/connecting_the_dots/val_data.zip) is a
validation set that contains a small amount of images.
### Training Network
As a first stage, it is recommended to train the disparity decoder and edge decoder without the geometric loss. To train the network on synthetic data for the first stage run
As a first stage, it is recommended to train the disparity decoder and edge decoder without the geometric loss. To train
the network on synthetic data for the first stage run
```
python train_val.py
```
After the model is pretrained without the geometric loss, the full model can be trained from the initialized weights by running
After the model is pretrained without the geometric loss, the full model can be trained from the initialized weights by
running
```
python train_val.py --loss phge
```
### Evaluating Network
To evaluate a specific checkpoint, e.g. the 50th epoch, one can run
```
python train_val.py --cmd retest --epoch 50
```
### Evaluating a Pre-trained Model
We provide a model pre-trained using the photometric loss. Once you have prepared the synthetic dataset and changed `DATA_ROOT` in `config.json`, the pre-trained model can be evaluated on the validation set by running:
We provide a model pre-trained using the photometric loss. Once you have prepared the synthetic dataset and
changed `DATA_ROOT` in `config.json`, the pre-trained model can be evaluated on the validation set by running: