{'fraction_non_alphanumeric': 0.03150996632383726, 'fraction_numerical': 0.010903795394557204, 'mean_word_length': 4.808416155635441, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Spectral Reconstruction and Disparity from Spatio-Spectrally Coded Light Fields via Multi-Task Deep Learning

We present a novel method to reconstruct a spectral central view and its aligned disparity map from spatio-spectrally coded light fields. Since we do not reconstruct an intermediate full light field from the coded measurement, we refer to this as principal reconstruction. The coded light fields correspond to those captured by a light field camera in the unfocused design with a spectrally coded microlens array. In this application, the spectrally coded light field camera can be interpreted as a single-shot spectral depth camera. We investigate several multi-task deep learning methods and propose a new auxiliary loss-based training strategy to enhance the reconstruction performance. The results are evaluated using a synthetic as well as a new real-world spectral light field dataset that we captured using a custom-built camera. The results are compared to state-of-the art compressed sensing reconstruction and disparity estimation. We achieve a high reconstruction quality for both synthetic and real-world coded light fields. The disparity estimation quality is on par with or even outperforms state-of-the-art disparity estimation from uncoded RGB light fields.


Introduction
Compared to traditional images, light fields contain much more information of a captured scene. Beside the conventional spatial information, light fields additionally capture the scene's angular information which enables applications such as refocusing [43], segmentation [62], and saliency detection [35], as well as depth or disparity estimation [60,61]. Moreover, one can extract reflectance properties such as the specular and diffuse components of a scene [2,55]. However, light fields also show a strong redundancy [34]. This is particularly true for hand-held plenoptic cameras due to the inherently small baseline. The redundancy becomes even more severe in the case of multi-or hyperspectral light fields in which the community has shown an increased interest. In some instances, spectral light fields outperform conven- tional RGB light fields, e.g. in depth estimation in specular regions [71] or profilometry [20]. Futhermore, spectral light fields offer new possibilities, combining methods from conventional light field imaging (e.g. disparity estimation) with those from spectral imaging (e.g. material classification). Traditionally, light fields are captured using either a camera array (or gantry), or using a camera with a microlens array (MLA) for which there are two design choices: the unfocused design [43] and the focused design [37]. In the case of spectral light field imaging, various approaches have been proposed, such as multi-camera setups [72,71], single camera snapshot imagers [26,66,64], as well as a camera using catadioptric mirrors [65]. Despite many benefits accomplished with these cameras, one might ask if it is actually necessary to capture a full light field in order to extract the desired information. Instead, one can capture a coded light field. While compressive light field cameras [4, 41,44] as well as compressive spectral light field cameras [64,40] have been studied in several instances, the focus of these presentations lay on reconstruction using compressed sensing (CS): given a compressed measurement, one can reconstruct the original signal using the l 0 -norm as a reconstruction prior. In the case of coded light fields, it seems superfluous to reconstruct the high dimensional light field from the low dimensional compressed measurement, only to extract again low dimensional (yet complex) information from it. Furthermore, the performance of common light field tasks may suffer due to the errors introduced by the light field recon-struction. Finally, CS reconstruction is computationally and memory demanding. Therefore, we propose to reconstruct the desired information from the coded light field directly. We refer to this as principal reconstruction. Here, we reconstruct the spectral central view and its disparity map but other reconstruction targets are also possible. We choose these targets as they represent a large amount of the information contained in the full light field. In fact, for non-occluding Lambertian scenes, the central view and its disparity are equivalent to the full light field. We perform the reconstruction of coded light fields as taken by a light field camera in the unfocused design with a spectrally coded MLA.
Since neural networks have become the state-of-the-art in estimating intrinsics or disparities from light fields [2, 53] but also in reconstruction from compressed measurements [22,31,33,11], we perform the proposed reconstruction using a supervised deep learning approach. The estimation of multiple targets from the coded measurements is inherently a multi-task problem. We investigate several training strategies to enhance the naive multi-task approach which is based on a simple weighted sum of losses. Furthermore, we propose a new strategy to regularize the single task losses to optimize secondary target metrics via gradient similarity which can be combined with the existing multi-task-adapted training strategies. In particular, our contributions are as follows: • We estimate a spectral central view and its disparity map from spatio-spectrally coded light fields as taken by a light field camera with a spectrally coded MLA.
• We propose a new training strategy leveraging auxiliary losses which we show enhances existing multi-task approaches in our application.
• Using a custom-built camera, we captured a reference dataset containing 12 spectral light fields of three highly textured scenes.
• The reconstruction is evaluated using synthetic and realworld data and compared to state-of-the-art CS-based reconstruction with subsequent disparity estimation.
The dataset and code are made publicly available [29, 30].

Coded Light Fields
In the plane-plane parametrization, the spectral light field is denoted by L(u, v, s, t, λ), where (u, v) corresponds to the angular component of the light field, (s, t) to the spatial domain, and λ denotes the spectral channel index. For MLA-based light field cameras, (u, v) and (s, t) are typically chosen to parameterize the main lens plane and the MLA plane, respectively. In the discrete case, one may equivalently use a tensor-based notation and identify L[u, v, s, t, λ] = L uvstλ , L ∈ R U ×V ×S×T ×Λ , (1) where (U, V ) corresponds to the angular, (S, T ) to the spatial, and Λ to the spectral resolution of the light field.
Related works: There are several possibilities to code light fields: in the angular, the spatial or the combined spatioangular domain [4]. In CS applications, the light field is typically coded in the spatio-angular domain using an attenuation mask [41,57,56]. However, these methods usually do not explicitly account for the color or spectral domain of the light field and perform the reconstruction channelwise, employing an additional Bayer mask. A generalization to spectral light fields in these instances is generally not straight-forward. Two approaches have been studied to spectrally code light fields: again, either coding the angular or the spatial component. While coding the angular component can easily be done for camera arrays by placing a spectral filter in front of each individual camera [72], it is challenging for MLA-based cameras. Previous studies have placed a spectral mask in the main lens plane [26,42], however, alignment of the mask with the camera sensor is virtually impossible to achieve: each spectral mask segment has to be imaged onto exactly one pixel since the pixels underneath each microlens code the angular component. Hence, when inevitably misaligned, the resulting coding is in fact not purely angular. Furthermore, the misalignment of the MLA and the sensor cannot be corrected via interpolation since each microlens image is only sparsely sampled. On the other hand, spatial coding in the case of camera arrays can be achieved by placing the same spectral mask in front of each camera sensor. For MLA-based cameras in the unfocused design [43], the same can be accomplished by coding the MLA [66], resulting in a spatio-spectral coding which we elaborate shortly. For completeness, the conventional Bayer sensor of an MLA-based light field camera also uses a spatioangular color mask. But the coding is not adapted to the light field geometry. The sensor image is usually first demosaiced and then decoded to an RGB light field. While light field camera-specific demosaicing methods exist [70,17], the geometric properties of the light field are not explicitly taken into account. Furthermore, this approach cannot be generalized to the multispectral case. While it is feasible in the case of conventional cameras [21], the number of measurements per microlens would simply be too sparse for standard sensor-based demosaicing. Hence, a more adapted spectral coding is needed. We believe that for hand-held MLA-based light field cameras, only the coding of the MLA is truly practical as the coding naturally aligns with the discrete sampling of the light field by the MLA. The light field decoding can be performed in complete analogy to the RGB case since every microlens image is fully sampled and can be aligned with the sensor via standard procedures [16].
Spatio-spectrally coded light fields: Whereas the other coding schemes have been thoroughly discussed in the literature, coding of the MLA has attracted only little atten- tion [66]. While this might be due to a challenging hardware realisation, spectrally coded MLAs have become feasible using conventional lithographic methods and modern techniques such as micro-optic inkjet printing [1,15].
For light field cameras in the unfocused design, the sensor is placed at a distance from the MLA equal to the focal length f of the microlenses as depicted in Figure 2. The MLA itself is placed in the focal plane with image distance I of the main lens. By spectrally coding the individual microlenses of the MLA, such that each microlens acts as a spectral bandpass filter, one obtains the spatio-spectrally coded light field (2) Here, M ∈ {0, 1} S×T ×Λ denotes the binary coding mask. Since only one filter is used in the imaging process at every spatial coordinate (s, t), M fulfills the one-hot constraint Λ λ=1 M[s, t, λ] = 1 . ( During the measurement, the coded light field is projected along the spectral dimension, When the coding mask M is known, which can be achieved during calibration, the coded L * can be obtained from its projection L * p since for every pixel only one spectral channel has a non-zero value in L * . Therefore, we consider L * and L * p to be equivalent in the following.

Reconstruction from Coded Light Fields
Traditionally, the full light field L is recovered from the coded measurement L * . For example, the Bayer-coded sensor image is demosaiced before the light field is decoded from it. When high compression ratios are involved, which is the case for coded light field camera designs and in particular when considering spectral light fields, the reconstruction can be done in the CS framework [19, 41, 56] by maximizing the reconstructed signal's sparsity in some adapted frame or basis while being conform to the coded measurement. From the fully recovered light field, the desired information is subsequently extracted. We consider two CS-based reconstruction methods which we discuss in Section 4.2.

Proposed Principal Reconstruction
Instead of reconstructing an intermediate full light field from the coded measurement, we propose to infer the desired properties from the coded light field directly. That is, given the coded measurement L * , estimating the central view I c [s, t, λ] and the corresponding disparity map D c [s, t] without the intermediate recovery of the full light field L. In this instance, the light field camera with a spectrally coded MLA can be interpreted as a single-shot spectral depth camera. We use an encoder-decoder network with multiple decoder streams to decode the spectral central view and disparity from the coded light field. In principle, the proposed method is not specific to the low dimensional reconstruction target-one could equally consider segmentation, saliency or reflection properties of the light field. A schematic comparison of conventional and principal reconstruction, in the case of the used targets I c and D c , is shown in Figure 1.

Network Architecture
Recently, many deep learning-based light field applications have been studied. In the case of disparity estimation, neural networks have significantly outperformed traditional methods [38,53] ]. An EPIvolume is a 3D section of the 4D light field, fixing one of the two angular coordinates. Usually, the central angular coordinates are fixed, resulting in two geometrically perpendicular 3D EPI-volumes which are used as the input. Alternatively, stereo-view pairs [52] or either the full or a sparse subsets of the light field are used [38,45,67,68].
Since in our application we are dealing with coded light fields, and hence only few measurements per subaperture, we use the full (coded, non-projected) light field as its input. We stack the coded subapertures along a single axis and use 3D convolutions to extract spatio-angular features.
For its versatility, we use a dual-stream U-net architecture [48], i.e. an encoder-decoder network with skip connections. The encoder maps the coded light field to a well adapted, low dimensional latent space. Then, using two jointly trained decoder paths, the central view and the disparity map are decoded from the latent representation. As input, the non-projected L * is used. This way, the coding mask is implicitly available to the network. We stack the subapertures of the light field along a new axis, resulting in an input of shape (S, T, U ·V, Λ). The encoder path is then built upon 3D residual convolution blocks. Spatio-angular downsampling is performed via strided 3D convolution. The decoder paths are built using 2D residual and transposed convolutions because the disparity and central view do not have an angular dependence. Therefore, 3D to 2D reshapes are necessary when connecting the encoder and decoders. This way, our approach combines a 3D U-net encoder [14] with dual stream 2D U-net decoders [48]. The proposed network architecture is depicted in Figure 3. More details on the proposed architecture and convolution blocks can be found in the supplementary material.
Related works: Two recent publications resemble our approach. Vadathya et al.
[56] propose a general framework for light field reconstruction from coded projections. In fact, similar to our approach, they estimate an intermediate central view and disparity field directly from the coded measurement. However, there are some crucial differences to our work. First, the estimated central view and disparity are used only intermediately to reconstruct the full light field from the coded measurement. In fact, the estimation networks cannot be trained without the full light field reconstruction as the network design and loss function are based on the full reconstruction. This directly opposes our approach. However, due to the self-supervised formulation, their approach can be trained using real-world data and does not require synthetic disparity ground truth data, which is useful in practice. Second, the considered coding schemes include angular integration and are only valid for attenuation mask-based compressive light field imagers. This does not include MLAmultiplexed coded light fields which we consider. And third, their approach, as many compressive light field approaches before, does not consider the color or spectral domain of the light field. The impact of demosaicing in compressive light field imaging remains unclear and has yet to be investigated. Furthermore, a new spectral depth camera, based on an end-to-end optimized free-form diffractive lens, has recently been proposed by Baek et al. [6]. The reconstruction targets are almost the same as ours-namely a spectral image and its aligned depth map. The crucial difference to our approach is that we explicitly use the angular component of the incoming signal instead of a phase modulation. This makes it possible to directly use the angular information in our decoding scheme which may be beneficial for the dispar-ity estimation. On the other hand, the approach by Baek et al. is quite general and considers higher spatial and spectral resolutions than ours. However, due to the joint hardand software design, a fair quantitative comparison of the different imaging setups is non-trivial or even impossible.

Training Strategies
Multi-task training: Using the proposed network architecture, the training is inherently a multi-task problem. The naive multi-task approach is to use a weighted sum of the individual task losses L i as the overall training loss in the case of N tasks. Here, w i > 0 are the task weights and L reg is a task-independent regularization term (such as weight decay) which we neglect in the following. The challenge in this straight-forward approach is to find suitable task weights w i which is time-and resource-intensive. Furthermore, it may not be possible to find optimal static weights. During training, the gradient of the loss with respect to the network weights is calculated. For each task, these weights contain some shared across all tasks (in our case the encoder weights), as well as task-specific weights (the individual decoder weights). The shared weights are hence updated based on the gradients from all tasks which can be problematic: the gradients from the different tasks may be on different scales leading to an imbalance during the weight update. Furthermore, the scales of the gradients may change differently during training. Finally, the tasks may also be of different complexity, leading to different convergence speeds which further enhances the task imbalance. To overcome these difficulties, some approaches to dynamically update the task weights w i during training have been recently discussed.
Here, we consider the Multi-Task with Uncertainty (MTU) approach [32], as well as the GradNorm method [13], both of which have shown good results in the context of computer vision. In both cases, the loss weights w i are considered adaptive or even trainable themselves. While the MTU approach proposes a new loss function obtained from the maximum log-likelihood of the model taking into account the individual task estimation uncertainties, GradNorm explicitly considers the task gradient norms and convergence speeds. For further technical details, we refer to the original literature. When the tasks compete, it may be necessary to adapt methods from multi-objective learning [51,36]. In the explored case of central view and disparity estimation however, we find that the used multi-task approaches perform on par or better than the corresponding single-task networks. Therefore, we did not explore multi-objective approaches. Auxiliary loss training: In computer vision, often the mean squared error (MSE) or mean absolute error (MAE) is used as a single-task loss function in regression tasks. The use of the MSE as the primary optimization and evaluation metric is well justified since it corresponds to the energy of the reconstruction error. Furthermore, the MSE is convex and continuously differentiable. However, both MSE and MAE are only evaluated pixel-wise and subsequently averaged. In particular, neither spatial nor spectral correlations are considered. Often, however, secondary quality measures are of key interest. E.g. the structural similarity (SSIM) [59] to asses the spatial reconstruction quality, or the spectral angle and the spectral information divergence [12] to evaluate the spectral reconstruction quality. To utilize these secondary metrics during optimization, ignoring the multi-task scenario for now, one can use the loss function using N aux auxiliary loss functions L aux,j to support the main loss L main . In principle, the problems with this naive approach are similar to those in multi-task learning. Namely, the manual (static) choice of the auxiliary loss weights and the possibly different scales of the loss gradients. Furthermore, the additional losses may even be adversarial to the main loss, leading to cancelling gradients, and the overall loss landscape may suffer from high curvature [69]. To mitigate this, the use of gradient similarity has been proposed [18]. Here, for each mini-batch during the training, the auxiliary loss weights are calculated using the truncated cosine similarity between the main and the auxiliary task gradients G main and G aux,j . While this resolves the issue concerning adversarial auxiliary losses and cancelling gradients, the problem of different gradient norms persists. Furthermore, since the calculation is performed for each mini-batch individually, the result may be quite noisy. To overcome these limitations we propose a modification which we call Normalized Gradient Similarity (NormGradSim). We extend the single-task loss, using N aux auxiliary losses L aux,j , to with dynamic weights α j , β j > 0 trained using the losses While α j is used to weigh the auxiliary loss according to its gradient similarity, β j is used to bring the gradient of the auxiliary loss to the same scale as the main loss. The normalization by (1 + j α j ) keeps the resulting gradient of the total loss L on the same scale as the original main loss L main . This has the advantage that NormGradSim can be used as a drop-in replacement to the single loss training (without having to adapt hyperparameters such as the optimizer's learning rate) or combined with multi-task approaches such as MTU and GradNorm, as the scale is unchanged. Combining the multi-task scenario with the proposed NormGradSim, we obtain the final overall loss function in combination with the additional loss functions L α , L β .

Dataset
For the supervised training, as well as the quantitative evaluation of the disparity estimation, synthetic spectral light field data is used. This is common since there are no suitable depth reference measurement techniques available. To further investigate the results, real-world spectral light field data is also evaluated. Using fully sampled spectral light fields and simulating the spatio-spectral coding, the reconstruction of the central view can be quantitatively evaluated.
Synthetic dataset: For synthetic spectral light fields we use the recently proposed dataset by Schambach and Heizmann [49]. The dataset contains 500 spectral light fields of shape (11, 11, 512, 512, 13). For training, test, and validation, the dataset is split 400:50:50 and patched into small light field patches of shape (9, 9, 36, 36, 13). Further, the dataset provides hand-crafted spectral light fields of shape (11, 11, 512, 512, 13). We will use these dataset challenges to evaluate all methods also for full-sized prediction. The angular resolution of the synthetic light fields is reduced to (9, 9) which is common in the light field community.
Real-world dataset: To our knowledge, the only public spectral light field dataset was made available by Xiong et al. [64]. This dataset consists of three spectral light fields (Boards, Toys, and Fruits) of shape (11, 11, 360, 270, 25) captured using a gantry-mounted 2D spectrometer. However, the objects used in the dataset are not all textured which is not ideal for the evaluation of the disparity estimation.
Therefore, we created a spectral light field dataset using a custom-built spectral light field camera. The camera consists of a Lytro Illum light field camera and a custom-built housing enclosing a filter wheel. The wheel holds 13 spectral filters ranging from 400 nm to 700 nm with 25 nm filter width. In this configuration, the light fields are spectrally sampled in complete analogy to the used synthetic dataset. To step the filter wheel automatically, the wheel is flangemounted on a stepper motor. The camera and the stepper motor are synchronously controlled by a Raspberry Pi. Since the Lytro Illum uses a Bayer pattern RGB sensor, the spectral calibration of the camera is rather challenging. We present our calibration procedure in the supplementary material. In total, we captured three different scenes, each using four different camera settings. To reduce the influence of the angular dependence of the interference filters, and to increase the imaged disparity range, the scenes are captured using the comparably large 150 mm and 250 mm main lens focal length equivalent. For each focal length setting, the scenes are imaged using two focus settings. The captured scenes were created with spectral variance and disparity estimation in mind. Hence, we used highly textured and colorful backgrounds and scene objects, and placed the objects as stretched out as possible to obtain a diverse disparity distribution. An RGB view of the scenes is given in Figure 4. In the used large focal length setting, the f -number matching of the Lytro Illum camera is suboptimal, leading to a smaller angular resolution than with shorter focal lengths. We crop the angular resolution of the captured light fields to (9, 9). Spatially, the light fields are cropped to (400, 400) to be compatible with the network's downsampling.
We will use spectral light fields from both datasets for the evaluation. For compatibility, we downsampled the dataset by Xiong et al.
[64] to 13 spectral channels and cropped the light fields to shape (9, 9, 256, 360, 13). As is common with real-world light field datasets, both datasets do not contain a depth or disparity reference. Hence, they can not be used to quantitatively evaluate disparity estimation performance, however a qualitative comparison is of course possible.

Baseline Methods
Since a comparable approach to ours has not yet been considered, no baseline exists for comparison. As we have elaborated, previous works on reconstruction from coded light fields cannot be applied to the used spatio-spectral light field coding. Hence, we investigate several multi-task training strategies and compare them to their single-task variants. Moreover, we compare the proposed approach with a CS reconstruction and subsequent disparity estimation. We investigate two CS approaches to reconstruct the full light field from the coded measurement, one based on the 5D-DCT and one dictionary learning approach. While full light field reconstruction is a more demanding task than the reconstruction of the central view alone, the full light field is needed for the disparity estimation. We consider a well-established CS reconstruction based on the convex relaxation of the l 0 -norm minimization. For the 5D-DCT-based reconstruction, we use the OWL-QN variant of the L-BFGS optimizer [8,3]. In the case of the dictionary learning approach, we employ sparse coding using the Fast Iterative Shrinkage/Thresholding Al-rogithm [7] combined with a mini-batch SGD minimization of the reconstruction error. Details on the investigated CS approaches can be found in the supplementary material. For a comparison of the estimated disparity, we use the state-ofthe-art EPINET [53] using the reconstructed uncoded light fields as input. EPINET is one of the top-performing methods in the HCI [25] for which a publication and reference implementation is available.

Training Details
All learning-based methods were implemented using the LFCNN framework [49] and trained using the same training dataset. During training, a random patch with spatial shape of (32, 32) is cropped from the input light field. For the light field coding, a random binary coding mask M, satisfying the constraint (3), is drawn independently for each light field in the mini-batch. This encourages the network to learn a maskindependent latent representation of the coded light field. This has the advantage that coded light fields of different input shapes and different coding masks can be reconstructed by the network. The trained network can hence be used for full-sized light field inference without modification. In principle, using a regular coding mask is also possible. But according to CS, random measurement matrices have a large incoherence with any orthonormal basis [10, 9] providing certain guarantees on the reconstruction [19]. For testing, the random seed of all random operations is fixed throughout all experiments, guaranteeing that the evaluation is always performed on the exact same coded data. As the main loss, for both the central view as well as the disparity estimation, the Huber loss [28] is used. In the case of the auxiliary loss approaches, we employ an SSIM-based loss and a spectralsimilarity loss for the central view task, and total variationbases smoothness and normal similarity losses [27] for the disparity task. The EPINET was trained as specified in the original paper [53], for which the (uncoded) training dataset was converted to RGB. Further details on the used training parameters, task weights and loss functions are presented in the supplementary material.

Results
A comparison of all considered methods evaluated on the test dataset is given in Table 1. As evaluation metrics for the reconstructed central view we use the Peak Signal-to-Noise Ratio (PSNR), the Structural Similarity Index Metric (SSIM) [59], the Spectral Angle (SA), and the Spectral Information Divergence (SID) [12]. For the disparity, we evaluate the Mean Absolute Error (MAE), the Mean Squared Error (MSE), as well as the BadPix07 (BP07) metric [25]. Regarding the CS methods we are surprised to see the straightforward 5D-DCT approach outperform the dictionary learning one in terms of the overall reconstruction PSNR. This might be because the DCT-based approach uses the full light field during the sparse coding while the light fields are patched for the dictionary-based method to match the light field atoms' shape. However, in both cases we observe a drastic loss of quality of the disparity estimated from the reconstructed light field as compared to the EPINET prediction from uncoded light fields. Even though the light field quality of the dictionary method is worse than the DCTbased one, the estimated disparity is much better. This is likely because the dictionary takes into account the light field geometry, which the DCT-based approach does not. For the succeeding disparity estimation, the improved light field geometry is of great importance. Therefore, we only consider the dictionary-based approach in the following.
In the case of the considered deep learning approaches, we observe that the naive multi task approach shows a significant drop in performance compared to its single-task variants, most severely in the case of the central view estimation. The two multi-task approaches, MTU and GradNorm, mitigate this loss in performance. However, GradNorm seems not to be able to resolve the task imbalance, as the disparity estimation performs worse than the naive multi-task approach, even though we have performed a brute force optimization of the method's task imbalance hyperparameter. In our application, the MTU approach yields a more balanced result than GradNorm, in contrast to the original findings [13]. Considering the auxiliary loss methods, the standard gradient similarity approach [18] does improve the primary and secondary metrics in the case of the central view reconstruction. However, the estimated disparity is worse than the MT baseline, likely due to an imbalance of the auxiliary task gradient norms. Our proposed NormGradSim approach, using a normalized gradient similarity, resolves this issue, leading to an improvement of all considered primary and secondary metrics for both the central view as well as the disparity estimation when compared to the naive MT baseline. Finally, combining the NormGradSim approach with the MTU method, the performance is further enhanced. The result is only slightly outperformed by the single-task central view reconstruction in terms of the PSNR. An evaluation of the methods using the synthetic dataset challenges and full-sized prediction is shown for all scenes in Figure 5 and for the Elephant scene in Figure 7. Visualizations of the remaining challenges can be found in the supplementary material. The proposed combined approach outperforms the other methods in almost all considered metrics and scenes. In particular, a significant improvement over the naive MT approach in the reconstructed central view can be observed. Again, it can be observed that the disparity estimation using EPINET from the CS-reconstructed light fields shows severe artifacts.
Regarding the real-world data, the results are a bit surprising. Here, the CS-based method slightly outperforms the deep learning approaches in the case of the estimated central view, as depicted in Figure 6 as well as Figure 8. While the result visually appears quite blurry, the overall central view quality is higher than that of the proposed method. However, the estimated disparity shows some significant artifacts, again supporting our claim that light field tasks suffer when applied to reconstructed light fields due to estimation noise and artifacts in the light field geometry. On the other hand, the disparity estimated using the proposed approach also shows some significant artifacts, in particular in the background. Therefore, also for the proposed method, a performance gap between synthetic and real-world data can be observed. This issue, which is present in many light field deep learning approaches trained with synthetic data, remains an open quest in the light field community and needs to be addressed in future investigations. Finally, note that the full-sized inference time of the proposed method is about 8 s per light field using an Nvidia Tesla V100 and can even be performed on mid-level 8 GB gaming GPUs while the CS reconstruction takes more than 3 h per light field using about 120 GB of a 40-core computing node with 192 GB RAM.

Conclusion
We proposed a new method to infer light field properties from coded measurements directly to which we refer as principal reconstruction. We reconstructed the central view and its aligned disparity map from spatio-spectrally coded light fields as taken by a light field camera with a spectrally coded microlens array achieving high quality results. Despite the challenging hardware realisation, the camera design offers the great advantage of being compact and single-shot.
Limitations and future work: The proposed NormGrad-Sim approach is computationally and memory intensive. We have experimented with gradient subsampling, using both static as well as stochastic subsets of the network weights to calculate the gradients. However, the performance gains of the full gradient-based method were not achieved. It is an interesting future investigation to employ dimensionality reduction methods, such as binary random projections, to the NormGradSim approach. Moreover, we are interested in a superresolution extension of the proposed architecture. Finally, optimization of the coding mask could further improve the reconstruction and will be investigated in the future.
Acknowledgment: This work was financed by the Baden-Württemberg Stiftung gGmbH. We acknowledge support by the state of Baden-Württemberg through bwHPC.

A. Network and Training Details
The proposed network architecture, as shown in Figure 9, is built using the blocks shown in Figure 10. For the encoder, the number of used filters per layer is doubled after every downsampling layer starting from 24 in the first residual block to 192 in the latent-space residual block. All convolutions of the encoder are 3D convolutions with a kernel size of (3, 3, 3), except for the residual convolutions with a kernel size of (1, 1, 1). Downsampling is performed using strided convolution with a (2, 2, 2) stride. The decoder is built symmetrically for both decoding paths, however 2D convolutions are used instead. For upsampling, 2D transposed convolutions with a (2, 2) stride are utilized. In the last layer of each stream, a (1, 1) convolution with either 13 or 1 features is performed to obtain the final shapes (S, T, 13) and (S, T, 1) for the reconstructed central view and disparity, respectively. The encoder features are joined with the decoder features via the skip connections by concatenation. In principle, it is straightforward to extend the encoder by an additional upsampling block to achieve superresolution in either one of the separate decoder paths, or to add (or replace) decoder paths to estimate different light field intrinsics.
In the case of the naive multi-task approach, we weigh each task equally, i.e. we choose w i = 0.5, i = 1, 2. The single-task networks are obtained by setting w i = δ ij . An overview of the used loss weights is given in Table 2.
For the main central view and disparity loss, we use the Huber loss. The single element Huber loss is defined as where e i = |y i −ŷ i | denotes the absolute prediction error of the i-th element for the vectorized estimateŷ with respect to the ground truth y. The overall loss is then calculated as the mean of the element-wise Huber losses with δ = 1.
For the auxiliary loss methods we use the SSIM-based to enhance the spatial reconstruction of the central view.
Here, the SSIM is calculated channel-wise and averaged. To enhance the spectral reconstruction, we use which is based on the spectral cosine similarity. The similarity is calculated along the spectral axis and spatially averaged. For the disparity task, we employ a total variation-based smoothness enhancing auxiliary loss. The used loss is similar to the one introduced by Repala et al. [47] but instead of weighing the local disparity gradients with the gradients of the central view, which is problematic in textured but constant-disparity regions, we calculate L TV (D c ,D c ) = ∂ xDc · e − ∂xDc + ∂ yDc · e − ∂yDc (14) using the disparity ground truth gradients. As opposed to the standard total variation, the exponential weighting should reduce edge-related artifacts. Furthermore, we use the disparity normal similarity loss [27] which is spatially averaged. The normals are calculated as Finally, layers that are preceded by batch normalization are regularized during training using the l 2 -norm of the weights (weight decay). The networks were trained for 170 epochs with a minibatch size of 128 using the YOGI optimizer [46] and a sigmoid learning rate decay from 5 × 10 −3 to 1 × 10 −4 which has shown to be superior to linear, exponential, and step decay in preliminary experiments.
All learning-based methods (the proposed approach, EPINET, and the dictionary learning) were trained using a single 32 GB Nvidia Tesla V100 GPU and 10 cores with 96 GB RAM of a shared GPU computing node. Inference with the deep learning methods was performed with the same hardware. The full-size inference of the synthetic dataset challenges as well as the real-world data in the case of the CS-based methods could not be carried out on the GPU due to the large memory requirements. Instead, they were carried out using a 40-core computing node with 192 GB of RAM. Training of the proposed methods took between 4 and 7 days, depending on the used training strategy. The training of EPINET took about 1 day. The dictionary training converged after 1 epoch in about 2 days.

B. Compressed Sensing-based Reconstruction
There are several approaches to solve the general compressed sensing reconstruction problem min α α 0 subject to l * − MΨα 2 < .
Here, Ψα = l ∈ R U ·V ·S·T ·Λ and l * ∈ R U ·V ·S·T denote the vectorized versions of L and L * p , respectively, Ψ denotes a basis (or frame) in which l has the sparse representation α and M corresponds to the measurement matrix.
In general, the minimization of the non-convex l 0 -pseudo norm is NP-hard [19]. While greedy methods, that directly tackle the l 0 -norm minimization, exist, we focus on the socalled convex relaxation methods here. When the restricted isometry property of the measurement matrix M and the basis or frame Ψ is fulfilled, the optimization problem (17) is equivalent to the convex LASSO problem [19] min α l * − MΨα 2 2 + λ α 1 for some coupling constant λ. In the case of light fields, the compressed sensing reconstruction is challenging due to the large dimensionality. This becomes even more severe in the case of spectral light fields. For example, even for a small light field patch of shape (9, 9, 32, 32, 13), which corresponds to the size of the used light fields in our test dataset (c.f . Section 4.1 of the main paper), the basis Ψ alone requires more than 4.6 TB of memory at 32 bit resolution. This is unfeasible even for large-scale computers, not even considering the case of full-sized light fields. The same issue is generally also true for the measurement matrix M. However, in our particular case, the coding takes a simple diagonal form M = diag(m) when not performing the projection of the spectral dimension. While this increases the memory requirements of the coded light field (because it is not spectrally projected) the memory requirements of the coding mask is reduced drastically. Furthermore, the coding can now be expressed as a simple element-wise multiplication instead of a matrix multiplication reducing the computational effort: Still, to overcome the challenges regarding the basis Ψ, we consider the following approaches.

B.1. DCT-based Reconstruction
Using the 5D-DCT as a basis for the spectral light field reconstruction and a functional optimization approach, explicitly saving the basis matrix Ψ can be avoided. The minimization problem (18) can be rewritten as where f (α) = l * −m Ψα 2 2 is convex and differentiable. We can explicitly calculate the derivative Here, we used that M T = M = diag(m) and that M is an orthogonal projection, i.e. M 2 = M. This makes the optimization suitable for the limited-memory BFGS optimization [8] in the orthant-wise limited-memory quasi-Newton variant [3]. Using a functional (non matrix-based) implementation of the 5D-DCT Ψ and its inverse transform Ψ T , this approach becomes feasible even for full-sized light field reconstruction. In our case, the full-sized reconstruction of spectral light fields with shape (9, 9, 512, 512, 13) requires about 96 GB of RAM. In principle, other basis transforms, such as the discrete wavelet transform or the signal-adapted wavelet packet transform, are also possible. However, due to the small angular resolution of the light fields, the DCT has been argued to perform comparable or better than the wavelet-based methods, especially for large compression ratios [5]. Since the DCT is computationally efficient and straightforward to implement, we are choosing it here. On the other hand, the DCT as well as wavelet-based transforms do not explicitly consider the light field geometry. While some light field-specific bases have been discussed, this is still an open and ongoing research topic. To make use of the light field geometry for a sparse representation, we consider the following dictionary learning approach.

B.2. Dictionary-based Reconstruction
Another possibility for compressed sensing-based reconstruction is to use a signal-adapted dictionary (or frame). Here, the goal is to find a dictionary D ∈ R N ×kN , where N = U·V ·S·T·Λ is the vectorized light field's dimension and k is the dictionary overcompleteness, such that the (possibly approximate) light field representation α ∈ R kN with is sparse. The columns d i , i = 1, . . . , kN , of D are called the atoms of the dictionary. Obviously, obtaining α from a given light field l is an inverse problem and may only be solved approximately. To learn a dictionary D from a training dataset L ∈ R N ×B containing B spectral light fields, the joint optimization problem has to be solved. Here, A ∈ R kN ×B denotes the sparse representation of all light fields in the training dataset. The constraint on D ensures that all atoms are normalized. We perform the optimization in an alternating manner, separating the non-convex problem (23) into two convex sub-problems for D and A separately [39]. Further, since the used training dataset contains over 200 GB of light field data, we employ mini-batch Stochastic Gradient Descent (SGD) optimization. Hence, for each optimization iteration step, first a sparse representation A of the light field batch is estimated using a fixed dictionary D, which is initialized using a truncated normal distribution and succeeding atom normalization. There are several approaches to estimate the sparse decomposition. Here, we use the Fast Iterative Shrinkage/Thresholding Algorithm (FISTA) [7] to solve In the second step, the sparse representation is fixed, and the dictionary optimization is performed updating the dictionary atoms using SGD and succeeding atom normalization. Over a fixed basis approach, the dictionary has the advantage of implicitly taking the light field geometry and redundancy into account. However, one still faces the problem of large dimensionality. Due to the dictionary overcompleteness, the problem is even slightly more severe than for the basis decomposition. Therefore, we train the dictionary with light field atoms of shape (5, 5, 8, 8, 13). To encode an input light field using the dictionary, the light field is first patched into the corresponding shape, using a spatial overlap of (4, 4) and an angular overlap of (1, 1). To avoid edge defects, overlapping patches are averaged when de-patching. We decided to not employ patching in the spectral domain as the characteristics of the different spectral bands are assumed to be quite different. The shape of the light field atoms was chosen as large as possible while still resulting in a manageable dictionary size. Using a dictionary overcompleteness of k = 2, which in previous works has been argued to be suitable for light field dictionaries [41], the dictionary is roughly 3.5 GB in size. With the additional memory requirements of the gradient backpropagation and light field patching, this was just small enough to perform the dictionary learning on a 32 GB Nvidia Tesla V100 GPU. Note, that the atom shape (5, 5, 8, 8, 13), while seeming small in the context of light fields, is actually comparably high dimensional. For imagebased dictionary learning, this corresponds to atoms of shape (144, 144), since 144·144 ≈ 5·5·8·8·13. However, even recent methods specifically adapted for high dimensional image dictionary learning only reach a feasible atom size of (64, 64) [54].

C. Spectral Light Field Camera Calibration
Our spectral light field camera is composed of a Lytro Illum camera and a custom-built housing holding a filter wheel with 13 spectral bandpass filters. The filter wheel is flange-mounted onto a stepper motor which is controlled, together with the camera, by a Raspberry Pi. A picture of our camera is shown in Figure 11.
The spectral light field L[u, v, s, t, λ] is measured in a spectrally scanning fashion where for each spectral channel a light field is captured by the Lytro Illum camera employing the corresponding spectral bandpass filter. Usually, the individual channels of a spectrally scanning camera are obtained using identical exposure times. However, this results in a strongly channel-dependent signal-to-noise ratio (SNR) due to the different spectral sensitivities which are determined by the filter characteristics, the quantum efficiency of the sensor, as well as the used light source. In our case, this effect is quite severe since we are employing regular daylight photo studio illuminants. To overcome this problem, the spectral channels are captured with their individually optimal exposure time. For example, in our case this results in very short exposures in the green channels and very long exposures of up to 2 s in the UV and NIR channels. This approach has the drawback that the camera needs to be radiometrically calibrated which is more cumbersome than the regular white balancing and de-vignetting. However, the radiometric calibration has the advantage that the additional Bayer-pattern RGB filters that are present in the Lytro Illum camera as well as the vignetting of the main lens (which is non-detachable) as well as the microlenses can be calibrated at once.
First, the camera's dark signal properties are estimated. Following the EMVA 1288 standard, the mean value of the Poisson-distributed dark signal d is given by The mean dark signal µ d is linear in the exposure time t with offset µ d,0 and slope µ I which is called the (mean) dark current. The offset and slope can be estimated by measuring an exposure series of dark images, i.e. images without any illumination and varying exposure time. The mean values µ d are approximated using the sample mean with a sample size of 10, i.e. the exposure series is repeatedly measured and averaged. The mean offset and dark current are estimated via a simple linear least-squares regression of the averaged exposure series using (26). Note that this calibration has to be performed individually for every used camera gain.
For this reason, we fix the camera gain to ISO 80 for all measurements.
To radiometrically calibrate the camera, an exposure series of spectral bright images is collected. Here, a bright im- Figure 11. Our custom spectral light field camera, using a Lytro Illum camera and a filter wheel, controlled by a Raspberry Pi. age refers to an image of the light source taken through an optical diffuser, achieving an almost ideal diffuse white scene. Following the EMVA 1288 standard, each pixel should obey the linear camera model: Here, g corresponds to the stochastic pixel grey value. The quantum efficiency is denoted by η and the system gain by K. The term λA hc E corresponds to the mean number of photons reaching the pixel (depending on the light source and the used lenses) and is unified in the scalar α which incorporates all spectral characteristics of the light source. Overall, the mean pixel grey value is linear in the exposure time. Now, in our case the camera employs additional spectral filters as well as a Bayer-pattern RGB sensor. Since the filters have the same effect on the incoming photons as the sensor quantum efficiency, i.e., a photon is either transmitted with a certain probability or not, the filters can be multiplicatively incorporated into (27) via where b n denotes the effective RGB filter and ϕ k the spectral filter transmissivity. Therefore, we can write the linear model for an abitrary spectral pixel (i, j, k) in a tensor-like fashion: The index n(i, j) of the used RGB filter is uniquely determined by the pixel position (i, j). We now factorize the linear dependence into its spatial and spectral components, i.e. we writeμ Here, v ij denotes all spatial dependencies such as the natural and mechanical main lens and microlens vignetting, and r k denotes the spectral responsivity which depends on the pixel's filter type n ∈ {R, G, B} and the used bandpass filter k. The goal is now to estimate v ij and r (n) k from the measured spectral bright image exposures series.
In order to process the full spectral exposure series tensor µ g,ijkl at once, which makes GPU acceleration (e.g. via Py-Torch or TensorFlow) straight-forward, certain care has to be taken to mask out overexposed pixels. Since the exposure series is measured for all spectral channels k, overexposure is unavoidable. For example, the green channels are much more sensitive than the NIR or UV channels and will therefore saturate much more quickly. However, overexposure is easy to handle by masking out all pixels with pixel value larger than 0.985, which corresponds to the threshold given by the four least significant bits of the 10 bit sensor 1 . However, this simple masking is not sufficient. As is shown in Figure 13, overexposed pixels influence neighboring pixels. In CCD sensors, the charges from saturated pixels overflow to neighboring pixels, in particular along the line at which the CCD sensor is read out. In the top left of Figure 13 we observe that the blue pixels saturate first, leading to a change of slope of the green pixels' sensitivity, since they are now also registering the overflown charges from the blue pixels. This is referred to as blooming in CCD sensors. However, the red pixels' sensitivity only changes slightly. This is likely because the red and blue pixels are only neighbored diagonally, whereas the green pixels are direct neighbors to both blue and red pixels. So when also the green pixels saturate, the red pixels' sensitivity also changes abruptly. To obtain a reliable estimate of the true sensitivity, it is clear that these measurements have to be masked out. We do this by using the available saturation mask and extend it to direct neighbors as well as neighbors in the 5 px neighborhood along the line along which the CCD sensor is read out. The filtered results are shown in Figure 13 (bottom). Furthermore, since the exposure times of the camera are logarithmically more densely sampled at short exposure times, we weigh the measurements logarithmically. Finally, we obtain an estimate of 1 (1111110000) 2 /(1111111111) 2 = 1008/1023 ≈ 0.985. the vignetting and responsivity using the model (30) and a weighted least-square fit. Since the model parameters are coupled, an analytic solution is not available. We minimize the squared error using PyTorch and the Adam optimizer. An example result of the fitted vignetting and responsivity is given in Figure 14. Since the full spectral exposure series cannot be loaded onto the GPU at once (the measurements add up to about 65 GB per camera configuration), the measurements are spatially patched using 64 windows with 50 % overlap.
The individually captured (monochromatic) raw light fields have then to be decoded, and concatenated to obtain the spectral light field. To decode the raw sensor images to a light field, the camera has to be geometrically calibrated. That is, the regular MLA grid has to be estimated from the individual ML centers. Here, we use the calibration and decoding scheme proposed by Schambach and Puente León [50] which itself is a vignetting-aware refinement of the well established decoding method by Dansereau et al. [16]. For each focus and zoom setting, a regular grid is estimated to approximate the individual ML centers. The raw image is then aligned with the regular grid and patched into a light field. After patching, the obtained light field has to be resampled from a hexagonal to a rectangular grid. Since this is well established it is not elaborated in more detail here and the interested reader is referred to the original literature.