{'fraction_non_alphanumeric': 0.02749840865690643, 'fraction_numerical': 0.016210481646509654, 'mean_word_length': 4.771736468283125, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Pruning-based Topology Refinement of 3D Mesh using a 2D Alpha Mask

Image-based 3D reconstruction has increasingly stunning results over the past few years with the latest improvements in computer vision and graphics. Geometry and topology are two fundamental concepts when dealing with 3D mesh structures. But the latest often remains a side issue in the 3D mesh-based reconstruction literature. Indeed, performing per-vertex elementary displacements over a 3D sphere mesh only impacts its geometry and leaves the topological structure unchanged and fixed. Whereas few attempts propose to update the geometry and the topology, all need to lean on costly 3D ground-truth to determine the faces/edges to prune. We present in this work a method that aims to refine the topology of any 3D mesh through a face-pruning strategy that extensively relies upon 2D alpha masks and camera pose information. Our solution leverages a differentiable renderer that renders each face as a 2D soft map. Its pixel intensity reflects the probability of being covered during the rendering process by such a face. Based on the 2D soft-masks available, our method is thus able to quickly highlight all the incorrectly rendered faces for a given viewpoint. Because our module is agnostic to the network that produces the 3D mesh, it can be easily plugged into any self-supervised image-based (either synthetic or natural) 3D reconstruction pipeline to get complex meshes with a non-spherical topology.


Introduction
The image-based 3D reconstruction task aims at building a 3D representation of a given object/scene depicted in a set of images. From a very early age, humans learn to apprehend their surrounding 3-dimensional environment and thus have high cognitive abilities for mentally representing the whole 3D scene structure from a single image. Doing so for any vision algorithm is way more challenging since computers do not have such sensitive prior knowledge. Inferring 3D information from a lower dimensional 2D space is thus an arduous task in visual computing. Whereas literature has tackled image-based 3D reconstruction for decades in computer vision and graphics with robust and renowned techniques such as Structure-from-Motion [14], the latest learning-based approaches address the problem through the new prism of deep neural networks [9,4,21].
The single-image-based 3D reconstruction issue even brings the challenge one step above as input information is solely constrained to a single image. From a general perspective, the latest contributions in single-image 3D reconstruction chose to work with mesh structures rather than 3D point clouds or voxels since they offer a well-balanced trade-off between computational requirements and tiny 3D details retrieval. Meshes also embed a notion of connectivity between vertices, contrary to the point cloud representation where such valuable property is inherently missing.
The rendering operation somehow fills the gap between the 3D world and the 2D image plane by mimicking the optical image formation process. Whereas the procedure is well-known in graphics for decades, it has only been brought into computer vision learning-based approaches for a few years. Indeed, the rasterization stage involved in any rendering process is intrinsically non-differentiable (since it requires a face selection step), making its integration in any deep architecture intractable from a backward loss computational perspective. The latest progress has led a few years ago to single-image 3D reconstruction methods where 3D ground truth labels are no longer needed: supervisory signal directly comes from a differentiable renderer at the 2-dimensional image level.
There are two main ways to update the topology of any mesh during 3D object reconstruction: by either pruning some edges/ faces or, on the other hand, by adopting the opposite strategy and thus adding edges or vertices at the correct location to generate new faces onto the mesh surface. Single-image 3D reconstruction methods that require 3D supervision already apply these techniques in their training pipeline [18,16,22]. However, most of the current state-of-theart methods in self-supervised single-image 3D reconstruction -where 3D labels are thus no more needed-perform mesh reconstruction with a roughly similar approach. An Encoder-Decoder network iteratively learns to predict an elementary per-vertex displacement on a 3D template sphere to faithfully reconstruct, as better as possible, the mesh associated with the input images. Such a strategy only affects the geometry of the mesh and thus does not get consideration for its topology. Indeed, vertice position impacts edges length and dihedral face angles but leaves the overall topology unchanged: two faces sharing an edge at the beginning of the training still do so at the end. These topological considerations, yet fundamental when embracing 3D mesh structures, are often bypassed in the current self-supervised single image-based 3D reconstruction literature. We thus claim that the latest advances in differentiable rendering [12,20] are informative enough to address this fundamental concept.
Our work thus brings topological considerations to the self-supervised imagebased 3D reconstruction issue. From a general perspective, our method leverages the differentiable renderer from [20] to catch up through an efficient and fast procedure the most likely mesh's faces to prune without accounting for costly 3D supervision, as done in [18,16,22]. As far as we are informed, no attempts in the current literature exist in this direction. Our work is thus in line with self-supervised image-based 3D reconstruction methods, while our topological refinement method is agnostic to the mesh reconstruction network used.
We summarise our contribution through: -A fast and efficient strategy to prune faces on a 3D mesh by only leveraging 2D alpha masks and camera pose. -An agnostic topological refinement module to the 3D mesh reconstruction network.

Related works
Differentiable renderer Since our work aims to be integrated within a deep architecture as an add-on module to perform complex 3D mesh reconstruction, we naturally focus on existing state-of-the-art differentiable renderers. Even though they perform much better than their differentiable counterparts, they can not be plugged into learning-based networks: there will be a network layer where back-propagation can no longer take place. OpenDR [15] paved the way in 2014 regarding differentiable rendering. However, the such topic has only gained significant interest over the past few years in deep learning-based computer vision tasks. Compelling progress was reached in 2017 by Hiroharu Kato &al. with an approximated gradient-based strategy called NMR [10]. But SoftRasterizer [12] designed the first differentiable framework without gradient approximation through a probability-distance-based formulation whereas Chen &al. designed their differentiable renderer with foreground-background pixel consideration in their DIB-R [1] method. In addition to those renderers that are thus primarily designed to work with mesh, other types of renderers [17,8] also emerged a few years ago to address the rendering of implicit 3D shape surfaces. Single Image-based 3D Reconstruction Initiating works [2,5,27] related to learning-based single image 3D reconstruction extensively leveraged on 3D datasets [25,23] to let the generative network apprehends the 3D structure it must learn. These methods lack the physical image formation process during training since there is no need to consider it as soon as 3D labels are accessible. In this way, existing 3D loss functions are sufficient to predict feasible 3D mesh structures from a 3D sphere template. While tremendous works have leveraged over 3D labels, the current trend in single image-based 3D reconstruction instead tries to advantage differentiable renderers and thus limit the need for expensive 3D supervision. It led in the last few years to a new path of work called selfsupervised image-based 3D reconstruction [9,11,19,7] where 3D ground truth meshes are no more needed. Differentiable rendering allows to render the predicted 3D mesh onto a 2D image plane and gets a meaningful 2D supervision signal to train a mesh reconstruction network in an end-to-end way. Topology Implicit-based methods spontaneously handle complex topology since any 3D object parameterises in a continuous 3-dimensional vector field where the notion of connectivity is absent. Generated surfaces do not suffer from resolution limitations as soon as the 3D space is continuously defined. Works relying on such formulation produce outstanding results but often require extensive use of 3D supervision [21], even though the latest research achieved reconstructing 3D implicit surfaces without 3D labels [17,13].
The topological issue on explicit-based formulation are already addressed when it comes to supervise the mesh generation with 3D labels. Pix2Mesh [24] leverages the capacity of Graph Neural Networks and their graph unpooling operation to add new vertices on the initial template mesh during training. With the same will to add a new vertex/face, GEOMetrics [22] considers an explicit adaptive face splitting strategy to locally increase face density and thus ensure that the generated mesh will have enough detail around the most complex regions. The face splitting decision relies on local curvature consideration with a fixed threshold. These two methods adopt a progressive mesh growing strategy and thus start from a low-resolution template mesh to end up with a 3D mesh which is complex only in the most challenging regions to reconstruct.
On the other hand, Junyi Pan &al. [18] paved the way to prune irrelevant faces onto 3D mesh surface. They introduced a face-pruning method through a 3D point cloud-based error-estimation network. While [18] used a fixed scalar threshold to determine whether or not to prune a face, Total3D [16] proposes a refined version of such a method by performing edge pruning with an adaptative thresholding strategy set on 3D local considerations.
To the best of our knowledge, such topological issue on 3D mesh structures is currently not addressed in the state of the art methods that extensively rely on 2D cues for training. Generated meshes are thus always isomorphic to a 3D sphere.

Method
We introduce our method and the associated framework in this section. We draft a complete overview of our methodology before digging into the implementation details of the module we designed.
Regarding the notation, we denote by I ∈ R H×W ×4 the source RGBα image, where α therefore refers to the (ground-truth) alpha mask. We aim to refine the topology of a mesh M=(V,F) where V and F respectively stand for the set of vertices and faces. We assume such mesh was obtained from a genus-0 template shape by any single-image 3D mesh reconstruction network (fed with either the RGB image or its alpha mask counterpart). Finally, the camera pose θ is parametrized by an azimuth and an elevation angle, leaving the distance between the object and the camera fixed.

General overview
As we extensively rely on the 2D information from α (even though the 3D corresponding camera pose θ is needed) to perform topological refinement over the mesh surface, we must lean on a renderer to get back onto 2D considerations. We consider the differentiable one from PyTorch3D [20] since it allows the generation of meaningful per-face rendered maps that one can aggregate to produce the final rendered mask. The core idea of our work is to identify the faces that were re-projected the worst onto the 2D image plane during the rasterization procedure through the prior information from α. Figure 1 depicts the general overview of our face-pruning method. Detecting those faces is driven through the computation of an Intersection over Union (IoU) score between each per-face rendered map with ground-truth α. Those faces can then be removed from the 3D mesh surface or directly discarded in the shader stage of the renderer. Inspired by the thresholding strategy introduced in TMN [18], we get consideration for t, an adaptative threshold based on the IoU score distribution γ/Γ and quantile Q τ , τ ∈ [0, 1].
In a similar fashion line to what TMN [18] did for the thresholding strategy in their pipeline architecture, the setting of τ influences the number of pruned faces: the lower τ is, the lower the number of faces detected as wrongly projected will be.

Implementation details.
We implement our topological refinement strategy onto the renderer from the PyTorch3D [20] library. The renderer's modularity offered by [20] is worth mentioning since the entire rendering procedure can be adjusted as desired. We paid attention to the rasterization stage for its connivance with the one from Soft-Rasterizer [12].
One of the core differences between those two frameworks in the silhouette rasterization process concerns the number of faces involved: while PyTorch3D only considers for each pixel location p i the top-K closest faces from the camera center, SoftRasterizer equally considers all the faces of M. We denote by P ∈ R K×(H×W ) the intermediate probability map produced by [20] which is highly related to the one originally introduced in [12]. Considering any 2D pixel location p i = (x i ; y i ) ∈ {0, ..H − 1}× ∈ {0, ..W − 1} and the k th closest face f i k , the distance based probability tensor P is expressed through: where d(f i k , p i ) stands for the Euclidean distance between p i and f i k , while σ is a hyperparameter to control the sharpness of the rendered silhouette image. Both d and σ are defined in SoftRasterizer [12].
It is worth emphasizing the indexing notation of P. Indeed, face indexes f i k and f i k , {i, k} = {i , k } might refer to the same physical face on M because a rendered one is likely to cover an area larger than a single pixel. One could already build up an aggregation function to render a final predicted alpha mask from P but the computational cost would not be optimal.
We thus introduced F as the set of unique faces from P involved in the rendering of M. The larger K is, the more likely the cardinality of F will get close to the total number of faces in the original mesh |F |.
We denote by D = {D j } |F | j=1 ∈ R |F |×(H×W ) the probability map tensor, as defined in [12], that accounts (contrary to P) on all the unique faces (indexed f j ) involved in the rendering process. Following Equation 2 formulation, we have for any pixel location p i : Our module status on pruning the face f j considering the degree of overlap between the ground truth α and the corresponding probability map D j . Since each face f j ∈ F contributes to the final rendered, an Intersection over Union (IoU) term is computed per face: The ratio γ j /Γ j gives the well-known IoU score. We extend the computation for a single face f j to all the faces from F, and denote by γ/Γ ∈ R |F | the complete IoU score distribution.
We adopt a thresholding strategy partially inspired from [18] and set an adaptative threshold t based on statistical quantile consideration: faces with a lower IoU score than t = Q τ (γ/Γ ) are pruned from M to give a refined mesh M r .
Given all these considerations, two different predictions can be made on the final rendered mask: Whileα to the original predicted alpha mask (without any faces pruned),α r refers to the refined predicted silhouette, with F p = {f p ∈ F|γ p /Γ p < t}

Experiments
Dataset We extensively tested our approach on ShapeNetCore [25]. In line with the work from TMN [18], our experiments are thus limited to the topologically challenging "chair" class from [25]. It contains 6774 different chairs, with 1356 instances in the testing set.
Metrics We evaluate our method through both qualitative and quantitative considerations. We use the 2D IoU metric to assess how well the refined mesh produced by our module better matches the ground truth alpha mask compared to the topologically non-refined mesh. We also use 3D metrics with the Chamfer Distance (CD), F-Score and METRO distance to evaluate our method. The METRO criterion was introduced in [3] and reconsidered in Thibault Groueix &al. 's AtlasNet [6] work. Its use is motivated by its consideration for mesh connectivity contrary to the CD or F-score metric that only reason onto 3D point clouds distribution. 3D Mesh generation network Our refinement module can be integrated into any image-based 3D reconstruction pipeline and is thus agnostic to the network responsible for producing the 3D mesh. We chose to work with the meshes generated by [18]. Since we only want to focus on face-pruning considerations, we only retrain the ResNet18 encoder and the first stage of their 3D mesh reconstruction architecture, referred to as SubNet-1 in [18] and abbreviated as TMN in this section. The TMN architecture thus consists of a deformation network and a learnt topological modification module. It is worth mentioning the TMN [18] architecture has been trained and used for inference with the provided ground truth labels and rendered images from 3D-R2N2 [2]. We called "Baseline" the deformation network preceding the topology modification network [18]. The genus-0 3D mesh produced by the Baseline network comes from a 3D sphere template with 2562 vertices. PyTorch3D Renderer We use the PyTorch3D [20] differentiable renderer and set K=30 and σ = 5.10 −7 to get the alpha mask as sharp as possible. All the 2D alpha masks, size 224x224, were obtained with the PyTorch3D renderer and have been centred. Similarly to what [2,12,26] did for the rendering silhouette masks, we considered 24 views per meshes with a fixed camera distance d camera = 2.732m and an elevation angle set to 30 • . The azimuth angle varies by 15 • increment, from 0 • to 345 • . All the meshes predicted by TMN [18] were normalised in the same way as ShapeNetCore [25]. We both present qualitative and quantitative results of our pruning-based method through 2D and 3D evaluation considerations. We demonstrate how effective our strategy can be by only leveraging 2D alpha masks and the renderer modularity.

Topological refinement evaluation -Qualitative results
We first seek to highlight to what extent we can detect irrelevant faces on the 3D mesh, i.e those that might be pruned during rendering. Figure 2 depicts the wrongly rendered faces (considered as is by our method) compared to the ground-truth alpha mask on three different chairs. Based on these 2D silhouette considerations, we achieve visually more appealing results than [18].  viewpoints from the same chair instance. In this example, the TMN pruning module failed to detect some faces to discard. It produced the same mesh as the baseline one, while our method successfully pruned the faces that have been rendered the worst, according to the ground truth alpha mask. Pruned faces on each view are independent of the other viewpoints.
Even the viewpoint associated with a tricky azimuth angle as the one depicted in the last column of Figure 3 is informative enough for our module to remove the relevant faces during rendering.

2D and 3D-based quantitative evaluation
We compare the performances of our method through different thresholds τ in Table 1 with the meshes produced by the Baseline network and TMN [18]. From the 1356 inferred meshes in the ShapeNetCore [25] test set, we manually selected 50 highly challenging meshes (from a topological perspective) and rendered them through 24 different camera viewpoints with the PyTorch3D renderer. The intrinsic F-score threshold was set to 0.001. A total number of N=10.000 points  Our method outperforms the learned topology modification network from TMN [18] according to Table 1 when compared using the 2D IoU score. It is worth re-mentioning that presented results for TMN [18] come from the first learned topological modification network. They thus do not consider the topological refinement from the SubNet-2 and SubNet-3 networks. Whereas none of our configurations (with different τ values) overperforms TMN [18] on 3D metrics, we stress two points: 1. Topologically refined mesh by our method always get better results than the ones produced by the Baseline. 2. Our face-pruning strategy only relies on a single 2D alpha mask and does not require any form of 3D-supervised compared to [18].
Since the method we designed only relies on 2D considerations, the camera viewpoint we considered to perform the topological refinement must influence the different evaluation metrics. We show in Figure 4 to which extent the camera pose affects both the 2D IoU and the CD scores.  Azimuth angles around the symmetrical pair {90 • , 270 • } are more challenging since there are not as informative as the viewpoints close to 180 • . Indeed, our method struggles to get better results than the Baseline in these cases. Our test set is imbalanced because it only contains more instances with topologically complex back parts to refine than with armrests. Our method thus slightly performs worse than the Baseline around both 90 • and 270 • angles as chairs' back complex structures are invisible from these viewpoints.
Finally, we also quantitatively confirm the intuited impact of τ during the rendering process on the 2D IoU score: the higher τ is, the larger the number of faces we discarded.

Limitations and further work
Our method shows encouraging results in 3D meshes topological refinement through 2D alpha mask considerations but has few remaining limitations. Firstly regarding the thresholding approach we used to prune whether or not a face on the 3D mesh surface. While we require to set a fixed hyperparameter -τ -in our method as [18] did, we align on [16] claims and emphasise the absolute need to rely on local 2D and 3D prior information to propose a clever and more robust thresholding strategy. Moreover, our module might also incorrectly behave on the rendered faces close to the silhouette boundary edges.
From a broader work perspective, our method currently relies on alpha masks and thus leaves behind texture information from RGB images. While impressive 3D textured results exist with UV mapping on self-supervised image-based 3D reconstruction methods with genus-0 meshes [11,19], no attempts have been made to the best of our knowledge to go beyond such 0 order. Finally, since our work is agnostic to the 3D mesh reconstruction network, a natural next move would be the design of a complete self-supervised 3D reconstruction pipeline with our topological refinement module integrated.

Conclusion
We proposed a new way to perform topological refinement onto a 3D mesh surface by only getting consideration for a 2D alpha mask. PyTorch3D [20] rasterization framework allows our method to spot faces to discard from the mesh at almost no cost. To the best of our knowledge, no attempt exist in our line of work since both TMN [18] and Total3D [16] respectively perform faces and edges pruning through 3D-supervised neural networks. In that way, our work introduced a new research path to address the 3D mesh topology refinement issue. The agnostic design of our method allows any self-supervised image-based 3D reconstruction pipeline -based on the PyTorch3D renderer framework -to leverage the work we presented in this paper to reconstruct topologically complex meshes. We obtained consistent and competitive results from a topological perspective compared to the 3D-based pruning strategy from [18].