Home | About | Journals | Submit | Contact Us | Français |

**|**Comput Intell Neurosci**|**v.2017; 2017**|**PMC5540412

Formats

Article sections

- Abstract
- 1. Introduction
- 2. Deep Boltzmann Machine
- 3. Train the Regression Model
- 4. Completion with Mask
- 5. Quantitative Evaluation
- 6. Experiments
- 7. Conclusion
- References

Authors

Related links

Comput Intell Neurosci. 2017; 2017: 5705693.

Published online 2017 July 19. doi: 10.1155/2017/5705693

PMCID: PMC5540412

School of Mathematical Sciences, Zhejiang University, Hangzhou, Zhejiang, China

*Zheng Wang: Email: moc.361@zw.flfwt

Academic Editor: Amparo Alonso-Betanzos

Received 2017 March 23; Revised 2017 May 19; Accepted 2017 June 12.

Copyright © 2017 Zheng Wang and Qingbiao Wu.

This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Shape completion is an important task in the field of image processing. An alternative method is to capture the shape information and finish the completion by a generative model, such as Deep Boltzmann Machine. With its powerful ability to deal with the distribution of the shapes, it is quite easy to acquire the result by sampling from the model. In this paper, we make use of the hidden activation of the DBM and incorporate it with the convolutional shape features to fit a regression model. We compare the output of the regression model with the incomplete shape feature in order to set a proper and compact mask for sampling from the DBM. The experiment shows that our method can obtain realistic results without any prior information about the incomplete object shape.

Shape completion is one of the most important tasks in the field of image processing. The goal of shape completion is to generate likely configurations of pixels for a missing region of the shape, given the rest of the shape. A lot of work has been done in the previous decades via a variety of methods on different conditions. For instance, completing the shape by constructing smooth curves [1], filling the missing area via the adjacent frames in a video [2], or performing the task through the repeated patterns in the image [3]. However, frequently there are no prior information about the position of missing area or we may lack the suitable context in the image for shape completion. This paper deals with this situation by the deep learning framework, a powerful branch of machine learning.

Approaches of machine learning have been successful in many other applications of image processing, such as segmentation, object detection, feature extraction, and inpainting. Among the various methods, generative graphical model, such as Markov Random Fields and Conditional Random Fields [4], has showed its ability to find the correlations of the neighboring pixels, which is important in the task of shape completion. Recently, deep architecture has demonstrated its potential to represent high level features in the image, often leading to better performance in many fields [5–7].

Deep Boltzmann Machine [8] is a multilayer generative model, which has the potential of learning internal representations that become increasingly complex. With the natural advantages of generative model, we can obtain the shape completion result by sampling from it [9, 10]. While sampling does quite a good job, we should acquire the prior information about the missing region, which is often impossible in many applications. To still obtain a realistic result, we should seek for the missing region automatically.

In this paper, we train a DBM and use its hidden activation combining with the convolutional shape features to fit a regression model. The regression model helps to set the mask for sampling, which corresponds to the missing region of the shape. While little work has been done before, our work shows that deep learning framework may afford an alternative competitive method for shape completion.

The remainder of the paper is structured as follows. In Section 2 we review the important deep architecture DBM, which is the foundation of our experiment. In Sections 3 and 4 we introduce the scheme for training the regression model incorporated with convolutional feature and setting the mask for sampling. In Section 5 we present methods for quantitative estimation. We provide the experimental evaluation in Section 6 and make a conclusion in Section 7.

A Deep Boltzmann Machine is a multilayer generative model which contains a set of visible units *v* {0,1}^{D}, and a set of hidden units *h* {0,1}^{P}. There are no intralayer connections. The DBM provides a richer model by introducing additional layers of hidden units compared with Restricted Boltzmann Machines, which are the building blocks of another deep architecture Deep Belief Network [11, 12]. We show the structure of these two models in Figure 1.

Consider a DBM with two hidden layers. The energy of the state {**v**, **h**^{1}, **h**^{2}} is defined as

$$\begin{array}{c}E\left(\phantom{\rule[-1.16998pt]{0ex}{9.21698pt}}\mathbf{v},{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}};\theta \phantom{\rule[-1.16998pt]{0ex}{9.21698pt}}\right)={\displaystyle \sum}_{i}{b}_{i}{v}_{i}+{\displaystyle \sum}_{i,j}{w}_{ij}^{\mathrm{1}}{v}_{i}{h}_{j}^{\mathrm{1}}+{\displaystyle \sum}_{j}{c}_{j}^{\mathrm{1}}{h}_{j}^{\mathrm{1}}\\ \phantom{\rule{11.436553955078125pt}{0ex}}+{\displaystyle \sum}_{j,k}{w}_{jk}^{\mathrm{2}}{h}_{j}^{\mathrm{1}}{h}_{k}^{\mathrm{2}}+{\displaystyle \sum}_{k}{c}_{k}^{\mathrm{2}}{h}_{k}^{\mathrm{2}},\end{array}$$

(1)

where {*w*_{ij}^{1}, *w*_{jk}^{2}} are the connecting weights between layers and {*b*_{i}, *c*_{j}^{1}, *c*_{k}^{2}} are the biases of each layer.

The probability of a visible state is

$$\begin{array}{c}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)=\frac{\mathrm{1}}{Z\left(\theta \right)}{\displaystyle \sum}_{{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}}}\mathrm{exp}\left(\phantom{\rule[-4.43001pt]{0ex}{9.52998pt}}-E\left(\phantom{\rule[-1.16998pt]{0ex}{9.21698pt}}\mathbf{v},{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}};\theta \phantom{\rule[-1.16998pt]{0ex}{9.21698pt}}\right)\phantom{\rule[-4.43001pt]{0ex}{9.52998pt}}\right),\end{array}$$

(2)

where *Z*(*θ*) = ∑_{v,h1,h2}exp (*E*(**v**, **h**^{1}, **h**^{2}; *θ*)) is the normalization constant. The conditional distributions over units in each layer are given by

$$\begin{array}{c}p\left(\phantom{\rule[-2.484pt]{0ex}{9.21698pt}}{v}_{i}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}{\mathbf{h}}^{\mathbf{1}}\phantom{\rule[-2.484pt]{0ex}{9.21698pt}}\right)=\sigma \left(\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}{\displaystyle \sum}_{j}{w}_{ij}^{\mathrm{1}}{h}_{j}^{\mathrm{1}}+{b}_{i}\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}\right),\\ \\ p\left(\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}{h}_{j}^{\mathrm{1}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v},{\mathbf{h}}^{\mathbf{2}}\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}\right)=\sigma \left(\phantom{\rule[-12.015pt]{0ex}{9.31497pt}}{\displaystyle \sum}_{i}{w}_{ij}^{\mathrm{1}}{v}_{i}+{\displaystyle \sum}_{k}{w}_{jk}^{\mathrm{2}}{h}_{k}^{\mathrm{2}}+{c}_{j}^{\mathrm{1}}\phantom{\rule[-12.015pt]{0ex}{9.31497pt}}\right),\\ \\ p\left(\phantom{\rule[-2.984pt]{0ex}{9.24498pt}}{h}_{k}^{\mathrm{2}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}{\mathbf{h}}^{\mathbf{1}}\phantom{\rule[-2.984pt]{0ex}{9.24498pt}}\right)=\sigma \left(\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}{\displaystyle \sum}_{j}{w}_{jk}^{\mathrm{2}}{h}_{j}^{\mathrm{1}}+{c}_{k}^{\mathrm{2}}\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}\right),\\ \end{array}$$

(3)

where *σ*(*x*) = 1/(1 + exp (−*x*)) is the sigmoid function.

To learn the parameters of DBM, we try to maximize the log-likelihood log *p*(**v**; *θ*) of the training data. It can be showed that the gradient of log-likelihood is

$$\begin{array}{c}\frac{\partial \mathrm{log}p\left(\mathbf{v};\theta \right)}{\partial \theta}={E}_{p\left({\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v}\right)}\left[\phantom{\rule[-7.18999pt]{0ex}{18.25998pt}}\frac{\partial E\left(\mathbf{v},{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}};\theta \right)}{\partial \theta}\phantom{\rule[-7.18999pt]{0ex}{18.25998pt}}\right]\\ \phantom{\rule{11.436553955078125pt}{0ex}}-{E}_{p\left(\mathbf{v},{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}}\right)}\left[\phantom{\rule[-7.18999pt]{0ex}{18.25998pt}}\frac{\partial E\left(\mathbf{v},{\mathbf{h}}^{\mathbf{1}},{\mathbf{h}}^{\mathbf{2}};\theta \right)}{\partial \theta}\phantom{\rule[-7.18999pt]{0ex}{18.25998pt}}\right].\end{array}$$

(4)

The first term on the right side is the expectation of the gradient of the energy with respect to the posterior distribution over **h**^{1} and **h**^{2} given the training data **v**. This term is also called the data-dependent expectation. The second term on the right side is the expectation of the gradient of the energy respect to the joint distribution of **v**, **h**^{1}, and **h**^{2}. This term is sometimes called model's expectation.

In practice, exact computation of both the data-dependent expectation and the model's expectation is intractable. Instead, we prefer some approximation methods.

Salakhutdinov et al. deal with the difficulties via variational inference and MCMC [8, 13]. Variational approach is used to estimate the data-dependent expectation [14]. The posterior distribution *p*(**h**^{1}, **h**^{2}**v**; *θ*) is replaced by another distribution *q*(**h**^{1}, **h**^{2}**v**; *μ*) which can be fully factorized: *q*(**h**^{1}, **h**^{2}**v**; *μ*) = _{i=1}^{D}*q*(*h*_{i}), where *h*_{i} denotes the hidden units in **h**^{1} and **h**^{2}, *D* is the number of all the hidden units, and *q*(*h*_{i} = 1) = *μ*_{i}. Thus, the aim is to maximize the lower bound on the log-likelihood:

$$\begin{array}{c}\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right){\displaystyle \sum}_{\mathbf{h}}q\left(\phantom{\rule[-2.59pt]{0ex}{7.08pt}}\mathbf{h}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v};\mu \phantom{\rule[-2.59pt]{0ex}{7.08pt}}\right)\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v},\mathbf{h};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)+H\left(\phantom{\rule[-2.59pt]{0ex}{4.53pt}}q\phantom{\rule[-2.59pt]{0ex}{4.53pt}}\right)\\ =\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)\\ \phantom{\rule{11.436553955078125pt}{0ex}}-\mathrm{K}\mathrm{L}\left[\phantom{\rule[-2.98001pt]{0ex}{8.07999pt}}q\left(\phantom{\rule[-2.59pt]{0ex}{7.08pt}}\mathbf{h}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v};\mu \phantom{\rule[-2.59pt]{0ex}{7.08pt}}\right)||p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v},\mathbf{h};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)\phantom{\rule[-2.98001pt]{0ex}{8.07999pt}}\right],\end{array}$$

(5)

where *H*(·) is the entropy and KL[·] is the Kullback-Leibler divergences.

The learning proceeds by maximizing the lower bound with respect to the variational parameters *μ*, or minimizing the KL divergences between the approximating and true posterior, equivalently.

To approximate the model's expectation, samples are drawn from the model distribution via Markov Chain Monte Carlo method [15]. Stochastic approximation procedure, also called Persistent CD, is used to generate samples [16–18]. In practice, we keep several Markov chains and use Gibbs sampler [15] while the states of the hidden units will be kept for next iteration. The conditional distributions required by Gibbs sampling are defined by (3). Many persistent chains can be run in parallel to better estimate the model's expectation [19, 20].

It should be noted that the pretraining stage has important influence on the generalization ability of DBM [21]. Since there are often millions of parameters in the DBM, the gradient ascent in the likelihood may get stuck in local optima with a bad initial value, which will finally lead to a poor model. To avoid this, a greedily training method should be used to find an ideal initial value. We begin by training a Restricted Boltzmann Machine [22, 23] on the training data [24]. The training of RBM is very similar to DBM and is more simple compared with DBM, because the data-dependent expectation is tractable in this case. Then we use the activation of the hidden units in the first RBM as the input to train a second RBM. Finally, we use the parameters of the two trained RBMs as the initial parameters to train a corresponding two-layer DBM with the proper size. The whole training procedure is concluded in Algorithm1. Some of the samples used or generated by DBM are shown in Figure 2.

In this section, we describe the procedure of training the regression model, which plays an important role in seeking the appropriate mask for sampling. Recall that our goal is to complete the shape of one specific class, and we have no prior information about the mission part of the shape. Meanwhile, the DBM has powerful ability to capture the structure of the shape and is able to generate similar samples via sampling. On this occasion, we will naturally think of the method to compare the incomplete shape with the samples from the DBM.

An alternative method is to compare the above two shapes pixel-wise and set the mask with a threshold previously assigned. In other words, the mask indicates the region where the intensity of pixel changes drastically between the normal shape and the incomplete shape, which we assume is just the missing part we want. This plausible procedure rarely works well in practice due to the property of DBM. The DBM deals with the sample pixel by pixel and directly compares them which may result in an improper mask corresponding to a scattered missing area, which would lead to an unrealistic completion result. What is more, our task is shape completion rather than inpainting or denoising; it would be more appropriate to expect a smooth and connected mask for each missing part instead of the scattered one.

For shape completion, if the mask is restricted in a too small area, the sampling result would be unrealistic or even the shape would be separated. On the other hand, if the mask covers a broad area, the unimpaired shape in the original image would be largely affected and the task would fail. The ideal mask should have a proper scale; in other words, the mask should cover the missing region while having little effect on the rest normal shape.

Thus we propose an approach to overcome the difficulties. First we convert the original training sample to the convolutional feature set by some convolutional filter. To simplify the situation, we just make use of the mean filter of certain size. We then make another activation feature of DBM by a modified mechanism similar to the conditional sampling procedure in DBM. Recall that the state of the hidden layer is sampled by

$$\begin{array}{c}{h}_{j}^{\mathrm{1}}~p\left(\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}{h}_{j}^{\mathrm{1}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v},{\mathbf{h}}^{\mathbf{2}}\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}\right),\\ \\ {h}_{k}^{\mathrm{2}}~p\left(\phantom{\rule[-2.984pt]{0ex}{9.24498pt}}{h}_{k}^{\mathrm{2}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}{\mathbf{h}}^{\mathbf{1}}\phantom{\rule[-2.984pt]{0ex}{9.24498pt}}\right).\\ \end{array}$$

(6)

The activation feature is acquired by

$$\begin{array}{c}\stackrel{~}{{h}_{j}^{\mathrm{1}}}=p\left(\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}{h}_{j}^{\mathrm{1}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{2}\mathbf{v},\mathbf{0}\phantom{\rule[-4.69899pt]{0ex}{9.24498pt}}\right),\\ \end{array}$$

(7)

$$\begin{array}{c}\stackrel{~}{{h}_{k}^{\mathrm{2}}}=p\left(\phantom{\rule[-2.984pt]{0ex}{10.137pt}}{h}_{k}^{\mathrm{2}}=\mathrm{1}\hspace{0.17em}\mid \hspace{0.17em}\stackrel{~}{{\mathbf{h}}^{\mathbf{1}}}\phantom{\rule[-2.984pt]{0ex}{10.137pt}}\right),\\ \end{array}$$

(8)

where $\stackrel{~}{{h}_{j}^{\mathrm{1}}}$, $\stackrel{~}{{h}_{k}^{\mathrm{2}}}$ are the obtained activation feature of each layer.

Attention need to be paid to these two formulas. In (7) we rescale **v** by 2**v** to approximate *p*(*h*_{j}^{1} = 1**v**, **h**^{2}) since the state of **h**^{2} is unknown. The sampling operator ~ is replaced by the assignment operator. For each sample in the training set, these two formulas are carried out only once.

Finally we fit a regression model with the activation feature and the convolutional feature. The object function to be optimized is

$$\begin{array}{c}{\Vert \phantom{\rule[-2.484pt]{0ex}{6.57999pt}}X{W}_{r}+{B}_{r}-C\phantom{\rule[-2.484pt]{0ex}{6.57999pt}}\Vert}_{2}^{2}+\lambda {\Vert \phantom{\rule[-2.484pt]{0ex}{6.57999pt}}{W}_{r}\phantom{\rule[-2.484pt]{0ex}{6.57999pt}}\Vert}_{2},\end{array}$$

(9)

where *X* is a matrix of *R*^{N×dh} and each row containing the activation of the hidden layer **h**^{2} is corresponding to each training sample. *W*_{r}, *B*_{r} are the parameters of the regression model with sizes *R*^{dh×dc} and *R*^{N×dc}. *B*_{r} is the duplicated version of the bias *b*, so that rows in *B*_{r} are identified with each other. *C* is the matrix of *R*^{N×dc}, and each row contains the convolutional feature of sample. *N* is the number of training samples; *d*_{h}, *d*_{c} are the dimensions of corresponding feature. *λ* represents the trade-off between the residual and the regularization item.

This optimization problem can be easily solved by stochastic gradient descent method. Thus we obtain the parameters *W*_{r} and *B*_{r}, which are important in the following stage.

With the regression model described above, we are able to set an appropriate mask. Given an incomplete shape, we first run the traditional sampling steps for a few iterations, and, during the last iteration, we use the modified formulas to get the required activation feature *h*_{a} in hidden layer **h**^{2}. We then reconstruct the convolutional feature by

$$\begin{array}{c}{c}_{\mathrm{r}\mathrm{e}\mathrm{c}}={h}_{a}\times {W}_{r}+{b}_{r},\end{array}$$

(10)

where *b*_{r} could be any row in the matrix *B*_{r}.

The mask is made by comparing the reconstructed convolutional feature with the convolutional feature *c*_{ori} obtained from the original incomplete shape, and we set the mask by

$$\begin{array}{c}{I}_{M\mathrm{1}}\left(\phantom{\rule[-0.12pt]{0ex}{4.53pt}}x\phantom{\rule[-0.12pt]{0ex}{4.53pt}}\right)=\left\{\begin{array}{cc}1\hfill & \left|{c}_{\mathrm{r}\mathrm{e}\mathrm{c}}\left(x\right)-{c}_{\mathrm{o}\mathrm{r}\mathrm{i}}\left(x\right)\right|>\tau \hfill \\ 0\hfill & \mathrm{o}\mathrm{t}\mathrm{h}\mathrm{e}\mathrm{r}\mathrm{w}\mathrm{i}\mathrm{s}\mathrm{e},\hfill \end{array}\right.\end{array}$$

(11)

where *I*_{M1}(*x*) denotes the intensity in the mask, and *τ* is the threshold to control the difference.

Assume that the filter used in the convolution stage is of size *m* × *m*, and we denote *m*(*x*) as the *m* × *m* area which centers at pixel *x*. Thus we could enhance the mask by

$$\begin{array}{c}{I}_{M\mathrm{2}}\left(\phantom{\rule[-0.12pt]{0ex}{4.53pt}}x\phantom{\rule[-0.12pt]{0ex}{4.53pt}}\right)=\left\{\begin{array}{cc}1\hfill & x\in m\left(y\right),\exists y,{I}_{M\mathrm{1}}\left(y\right)=\mathrm{1}\hfill \\ 0\hfill & \mathrm{o}\mathrm{t}\mathrm{h}\mathrm{e}\mathrm{r}\mathrm{w}\mathrm{i}\mathrm{s}\mathrm{e}.\hfill \end{array}\right.\end{array}$$

(12)

The whole procedure for setting mask is concluded in Algorithm2.

Roughly speaking, the hidden activation contains the correlate information between the pixels in the visual sample, and *h*_{a} represents the abstract feature of the normal shape captured by DBM. In contrast, the convolutional feature represents the information directly from the visual space. Since our completion task is focused on the visual space, it is important to establish the relationship between these two different features, which is just the regression model's job. Comparing these two convolutional features is a reasonable way to compare the samples with the generative model.

The convolutional feature is essential in our approach and it brings mainly two kinds of benefits: for one thing, it affords some robustness to the procedure, and the comparison in the convolutional feature space is more reasonable than the pixel-wise comparison in the visual space. For another, the convolution operation maintains the region that we are interested in, and the procedure from *I*_{M1} to *I*_{M2} represents an inverse operation from feature space to visual space, which is of great concern in the task of shape completion.

To facilitate the completion, we clamp the pixels out of the mask and replace the pixels within the masked area with the sampling result from DBM.

While the mask may capture the proper area, it may also contain other small scattered regions which we should not pay attention to. We should keep the useful active area as well as discard the others. We thus resort to some morphology methods [25]. In order to achieve our goal, we use opening operation which erodes the image first and then dilates it. After this operation, the mask becomes more compact and consistent.

While we could complete the shape via sampling, the probabilistic model defined by DBM may provide some quantitative information about the sample, which sometimes improves the result.

In the mean-field method discussed above, our aim is to maximize the lower bound on the log-likelihood:

$$\begin{array}{c}\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right){\displaystyle \sum}_{\mathbf{h}}q\left(\phantom{\rule[-2.59pt]{0ex}{7.08pt}}\mathbf{h}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v};\mu \phantom{\rule[-2.59pt]{0ex}{7.08pt}}\right)\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v},\mathbf{h};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)+H\left(\phantom{\rule[-2.59pt]{0ex}{4.53pt}}q\phantom{\rule[-2.59pt]{0ex}{4.53pt}}\right)\\ =\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)\\ \phantom{\rule{11.436553955078125pt}{0ex}}-\mathrm{K}\mathrm{L}\left[\phantom{\rule[-2.98001pt]{0ex}{8.07999pt}}q\left(\phantom{\rule[-2.59pt]{0ex}{7.08pt}}\mathbf{h}\hspace{0.17em}\mid \hspace{0.17em}\mathbf{v};\mu \phantom{\rule[-2.59pt]{0ex}{7.08pt}}\right)||p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v},\mathbf{h};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)\phantom{\rule[-2.98001pt]{0ex}{8.07999pt}}\right].\end{array}$$

(13)

Using the factorized distribution defined in the previous section, the lower bound can be represented as

$$\begin{array}{c}\mathrm{log}p\left(\phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\mathbf{v};\theta \phantom{\rule[-1.16998pt]{0ex}{7.08pt}}\right)\ge \frac{\mathrm{1}}{\mathrm{2}}{\displaystyle \sum}_{i,j}{w}_{ij}^{\mathrm{1}}{v}_{i}{\mu}_{j}^{\mathrm{1}}+{\displaystyle \sum}_{j,k}{w}_{jk}^{\mathrm{2}}{\mu}_{j}^{\mathrm{1}}{\mu}_{k}^{\mathrm{2}}-\mathrm{ln}Z\left(\phantom{\rule[-0.12pt]{0ex}{7.08pt}}\theta \phantom{\rule[-0.12pt]{0ex}{7.08pt}}\right)\\ \phantom{\rule{11.436553955078125pt}{0ex}}+{\displaystyle \sum}_{j}\left[\phantom{\rule[-4.43001pt]{0ex}{9.52998pt}}{\mu}_{j}\mathrm{ln}{\mu}_{j}+\left(\phantom{\rule[-4.19899pt]{0ex}{6.35999pt}}\mathrm{1}-{\mu}_{j}\phantom{\rule[-4.19899pt]{0ex}{6.35999pt}}\right)\mathrm{ln}\left(\phantom{\rule[-4.19899pt]{0ex}{6.35999pt}}\mathrm{1}-{\mu}_{j}\phantom{\rule[-4.19899pt]{0ex}{6.35999pt}}\right)\phantom{\rule[-4.43001pt]{0ex}{9.52998pt}}\right],\end{array}$$

(14)

where *μ*^{1}, *μ*^{2} are mean-field parameters for the corresponding hidden layer. Since ln *Z*(*θ*) is constant when the parameter *θ* is fixed and it is unnecessary to calculate the lower bound precisely, we only pay attention to the remaining term.

For a new sample *v*^{} from the DBM, we run the mean-field fixed-point equations for a few iterations to update the mean-field parameters for the new sample:

$$\begin{array}{c}{\mu}_{j}^{\mathrm{1}}=\sigma \left(\phantom{\rule[-12.015pt]{0ex}{9.31497pt}}{\displaystyle \sum}_{i}{w}_{ij}^{\mathrm{1}}{v}_{i}^{\ast}+{\displaystyle \sum}_{k}{w}_{jk}^{\mathrm{2}}{\mu}_{k}^{\mathrm{2}}+{c}_{j}^{\mathrm{1}}\phantom{\rule[-12.015pt]{0ex}{9.31497pt}}\right),\\ \\ {\mu}_{k}^{\mathrm{2}}=\sigma \left(\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}{\displaystyle \sum}_{j}{\mu}_{j}^{\mathrm{1}}{w}_{jk}^{\mathrm{2}}+{c}_{k}^{\mathrm{2}}\phantom{\rule[-13.359pt]{0ex}{9.31497pt}}\right)\\ \end{array}$$

(15)

and the convergence is usually fast. We then calculate the remaining terms in the lower bound, denoted by

$$\begin{array}{c}R\left(\phantom{\rule[-2.59pt]{0ex}{8.10399pt}}{v}^{\ast},{\mu}^{\ast}\phantom{\rule[-2.59pt]{0ex}{8.10399pt}}\right)=\frac{\mathrm{1}}{\mathrm{2}}{\displaystyle \sum}_{i,j}{w}_{i\mathrm{j}}^{\mathrm{1}}{v}_{i}^{\ast}{\mu}_{j}^{\ast \mathrm{1}}+{\displaystyle \sum}_{j,k}{w}_{jk}^{\mathrm{2}}{\mu}_{j}^{\ast \mathrm{1}}{\mu}_{k}^{\ast \mathrm{2}}\\ \phantom{\rule{11.436553955078125pt}{0ex}}+{\displaystyle \sum}_{j}\left[\phantom{\rule[-4.69899pt]{0ex}{9.52998pt}}{\mu}_{j}^{\ast}\mathrm{ln}{\mu}_{j}^{\ast}+\left(\phantom{\rule[-4.69899pt]{0ex}{8.10399pt}}\mathrm{1}-{\mu}_{j}^{\ast}\phantom{\rule[-4.69899pt]{0ex}{8.10399pt}}\right)\mathrm{ln}\left(\phantom{\rule[-4.69899pt]{0ex}{8.10399pt}}\mathrm{1}-{\mu}_{j}^{\ast}\phantom{\rule[-4.69899pt]{0ex}{8.10399pt}}\right)\phantom{\rule[-4.69899pt]{0ex}{9.52998pt}}\right].\end{array}$$

(16)

During sampling, we calculate *R*(*v*^{}, *μ*^{}) at every few steps of iterations, and replace the state *v*_{1} by *v*_{2} if *R*(*v*_{1}, *μ*_{1}) < *R*(*v*_{2}, *μ*_{2}). Otherwise we keep the state *v*_{1} as the initial state for the next few iterations.

It should be noted that *R*(*v*, *μ*) is the indicator of the lower bound rather than the real log-likelihood and we use *R*(*v*, *μ*) as a conservative strategy for the rationality of the completion result. If *R*(*v*_{1}, *μ*_{1}) > *R*(*v*_{2}, *μ*_{2}), we assume that log *p*(*v*_{1}) > log *p*(*v*_{2}). In other words, if *R*(*v*_{1}, *μ*_{1}) > *R*(*v*_{2}, *μ*_{2}), we think that *v*_{1} is more likely than *v*_{2} to be a suitable completion result, since *v*_{1} is more in line with the distribution of training samples.

The procedure of shape completion is described in Algorithm3 as a summary.

In this section, we demonstrate the completion results using the proposed method. We consider the Weizmann horse dataset as our training and test dataset. The Weizmann horse dataset (this dataset is publicly available and could be gotten from http://www.msri.org/m/people/members/eranb/weizmann_horse_db.tar.gz) contains 327 grayscale images of horses with various poses and sizes. The task is challenging because the model must capture the shape information with quite a small scale of dataset.

To train our DBM, we take 280 images as the training set while others test set. The images are normalized to 32 × 32 pixels as well as their convolutional shape feature. Thus the number of units in the input layer is 1024. We then train a DBM using the proposed method with 500,1000 units for layers **h**^{1}, **h**^{2}. The pretraining stage takes 400 epochs and the fine-tuning process takes 800 epochs. The total training procedure takes about 10 hours on an Intel Core i5 processor with 8GB of memory running by MATLAB. We do not use GPU in the series of experiments.

We then use a mean filter of 33 pixels to make the convolutional features and train the regression model using stochastic gradient descent. We randomly pick the samples from test set and create some incomplete shapes manually. The incomplete shapes are used as the input for our completion method.

We show our experimental results in Figure 3. Each column represents one same image in the different stages or result. The first row represents the test samples which have never seen before. The incomplete shapes are shown in the second row, which are made manually by setting the pixels of a quarter of the image to zero in the left above. The results in the third row are sampled from DBM where the initial visible states are just the incomplete shape, and no masks are used. We can find that although the shape in the image is complete, it changes a lot compared with the original shape and the completion is failed. For there are no constraints in the sampling procedure, any pixel in the image has some probability to change and the final result would get close to the samples drawn from the model distribution, while not keeping the original shape. The reason accounts for the usage of mask during the sampling procedure as well.

The completion result for some incomplete shapes. The original complete shapes are shown in the first row. The following rows represent the incomplete shapes, the completion result without any mask, the completion result with handmade mask, the mask found **...**

Thus we consider the next row in Figure 3. It represents the results where we use the manual mask. Since the incomplete shapes are made by ourselves, we have the prior information about the incomplete shapes. In other words, we can set the mask corresponding to the mission region exactly. The completion results reach the demand of reality and the shapes are similar to the original test samples. It is worth noting that this procedure is used to demonstrate the generative ability of the model in some related papers.

While the method of manual mask seems to meet the requirements to some extent, we should consider the case that appears more often where we have no prior knowledge about the mission region, which is the main objective in our work. Thus we must find the mask adaptively. The completion results by our method without any prior information are shown in the last row. Obviously, the completion results have not much difference between the two methods. Our method even generates more similar result to the test sample than the manual mask on some incomplete shapes such as the fifth column in Figure 3.

The result can be explained by finding mask with a proper scale. The masks found by our method are also shown in Figure 3. From that we see that each mask is constrained in the area near the head of horse, which is just the mission region we want to seek.

We could explain the completion result via the quantitative indicator *R*(*v*, *μ*). Values of *R*(*v*, *μ*) for samples in Figure 3 are shown in Table 1. The values of *R* for the incomplete shapes are much lower than the ones for the original shapes, since the incomplete shape is unfitted for the distribution modeled by DBM, which is a common result. We would pay more attention to the last three rows in the table. The value of *R* for the sample without mask is usually the highest one in the same column. Since there are no other constraints, the sampling procedure tends to obtain the result in the local optimum of the distribution modeled by DBM; thus the value of *R* is usually higher than other cases. As a result, samples without mask are easy to deviate from the original shapes or the incomplete shapes, which confirms the necessity of mask.

The values of *R* displayed in the fourth row indicate that the completion result is reliable from the point of probability, and, due to the mask, the completion result is also realistic from a visual standpoint. Finally, we focus on the result obtained by our method. It can be explained from two aspects. On the one hand, there is not much difference between the value of *R* for the original shape and the result through our method. It shows that our method can obtain quite reasonable result compared with the normal shape. On the other hand, the gap between the values of last two rows is limited, which demonstrates that our method has the ability to seek for a suitable mask without any prior information about the mission region.

For each incomplete shape in Figure 3, we run our method another 30 times and calculate the average value of *R* in each iteration. The results are shown in Figure 4. We find that the values of *R* almost stayed constant during the last few iterations, and the final values are close to the values shown in Table 1, which indicates that our method is relatively stable. The time cost is negligible due to the few number of iterations. Some other completion results with different missing regions are shown in Figure 6.

There are some other considerations that need to be emphasized. We believe that a direct comparison with other method is not fair. On the one hand, different methods require different conditions. For instance, the method in [1] requires prior information about the exact position of the contour of the shape. Some other curve-based methods also require similar prior information. The method in [2] requires the adjacent frames in video. The method in [3] requires the similar patches of the object. Our method does not apply to those situations, and vice versa. In other words, different methods tend to apply only to certain special cases. We believe that it is unfair to compare different methods under different conditions. So we prefer to select the method under similar conditions to compare. On the other hand, there is a lack of a common and accurate performance measurement for shape completion. A large number of methods only visually evaluate the results, such as the methods in [9, 10]. The pixel-based performance measurement, such as the Euclidian distances between the corresponding points of the completed shapes and the ground-truth outlines (e.g., the mean value of the error for the horse class is 0.7021 with the Euler spiral method in [1]), may be inappropriate for our method. Because of the above reasons, we only compare the variations of the proposed method and use the value of *R* as a kind of quantitative evaluation.

To verify that our method could be used in other situations more than the Weizmann horse dataset, we train another DBM on the MNIST digit dataset (this dataset is publicly available and could be gotten from http://yann.lecun.com/exdb/mnist/). The MNIST digit dataset contains 60,000 training and 10,000 test samples of handwritten digits from 0 to 9 with the size of 28 × 28 pixels, which is a benchmark in the field of deep learning. It should be noted that we regard our training as an unsupervised procedure rather than supervised procedure, and we do not use the class label during training.

In this experiment, we use the raw pixels of each sample as the input data; the numbers of hidden units for the next two layers are 500 and 1000. Due to the abundant training samples, we reduce the number of iterations during training. The pretraining stage takes 100 epochs and the fine-tuning process takes 200 epochs. The procedure for regression model is similar to the procedure described above.

The visual result and the term *R* are shown in Figure 5 and Table 2. We set the mission area corresponding to different four-quarters of the image in the first four samples and occlude the upper part of the last sample. We find that our method again obtains a comparatively satisfactory result. Something interesting has happened for the last sample. The completion result is the digit 4 rather than the original digit 9. We emphasize that we treat this completion result as a successful one. Recall that we assume we have no prior information about the missing region, and, for the case of multiple categories, this is equivalent to the case that we do not have the prior information for the class of the shape. In other words, the incomplete shape in the last column may come from a digit 9 as well as a digit 4, and the completion result is reasonable even the true digit is 9.

However, it should be emphasized that our method is highly dependent on the trained DBM with its model's distribution. The experiments also discovers that if the incomplete shape has a great difference compared with training samples, the task would be failed. This is because the shape deviates from the model's distribution greatly, and the procedure fails to estimate a proper mask for completion. From another perspective, our approach would be more powerful if the DBM is trained elaborately; for example, more training time or a more various and larger training dataset is provided.

In this paper, we have proposed a novel method for the task on shape completion via the powerful generative model DBM. In order to achieve better result, we train a regression model incorporating the hidden activation and the convolutional features, which plays an important role in the procedure of setting the proper mask. We search for an appropriate mask by sampling based on the mask from model's distribution. The experiments have shown that our method can achieve a satisfactory result without any prior information about the incomplete shape compared with manual method. Our work also demonstrates that the framework of deep learning may provide a competitive alternative method on shape completion.

This work is supported by the National Natural Science Foundation of China (Grant no. 11371320), Zhejiang Natural Science Foundation (Grants nos. LZ14A010002 and Y16A010025), and Foundation of Science and Technology Department (Grant no. 2013C31084) of Zhejiang Province.

The authors declare that there are no conflicts of interest regarding the publication of this paper.

1. Kimia B. B., Frankel I., Popescu A. Euler spiral for shape completion. *International Journal of Computer Vision*. 2003;54(1–3):159–182.

2. Kumar S., Biswas M., Belongie S. J., Nguyen T. Q. Spatio-temporal texture synthesis and image inpainting for video applications. Proceedings of the International Conference on Image Processing, ICIP '05; September 2005; Genova, Italy. IEEE; pp. 85–88. [Cross Ref]

3. He K., Sun J. Image completion approaches using the statistics of similar patches. *IEEE Transactions on Pattern Analysis and Machine Intelligence*. 2014;36(12):2423–2435. doi: 10.1109/TPAMI.2014.2330611. [PubMed] [Cross Ref]

4. Bishop C. *Pattern Recognition and Machine Learning (Information Science and Statistics)* 1st. New York, NY, USA: Springer; 2006.

5. Bengio Y., Courville A., Vincent P. Representation learning: a review and new perspectives. *IEEE Transactions on Pattern Analysis and Machine Intelligence*. 2013;35(8):1798–1828. doi: 10.1109/tpami.2013.50. [PubMed] [Cross Ref]

6. Bengio Y. Learning deep architectures for AI. *Foundations and Trends in Machine Learning*. 2009;2(1):1–27. doi: 10.1561/2200000006. [Cross Ref]

7. Schmidhuber J. Deep learning in neural networks: an overview. *Neural Networks*. 2015;61:85–117. doi: 10.1016/j.neunet.2014.09.003. [PubMed] [Cross Ref]

8. Salakhutdinov R., Hinton G. Deep boltzmann machines. Proceedings of the International Conference on Artificial Intelligence and Statistics; 2009; pp. 448–455. [Cross Ref]

9. Eslami S. M., Heess N., Williams C. ., Winn J. The shape Boltzmann machine: a strong model of object shape. *International Journal of Computer Vision*. 2014;107(2):155–176. doi: 10.1007/s11263-013-0669-1. [Cross Ref]

10. Kivinen J. J., Williams C. Multiple texture boltzmann machines. Proceedings of the International Conference on Artificial Intelligence and Statistics; 2012; pp. 638–646.

11. Hinton G. E., Osindero S., Teh Y.-W. A fast learning algorithm for deep belief nets. *Neural Computation*. 2006;18(7):1527–1554. doi: 10.1162/neco.2006.18.7.1527. [PubMed] [Cross Ref]

12. Salakhutdinov R., Murray I. On the quantitative analysis of deep belief networks. Proceedings of the 25th International Conference on Machine Learning; July 2008; Helsinki, Finland. ACM; pp. 872–879.

13. Salakhutdinov R., Larochelle H. Efficient learning of deep boltzmann machines. Proceedings of the International Conference on Artificial Intelligence and Statistics; 2010; pp. 693–700.

14. Saul L. K., Jaakkola T., Jordan M. I. Mean field theory for sigmoid belief networks. *Journal of Artificial Intelligence Research*. 1996;4(1):61–76.

15. Gasparini M., Gilks W. R., Richardson S., Spiegelhalter D. J. *Markov Chain Monte Carlo in Practice*. CRC press; 1995. [Cross Ref]

16. Hinton G. E. Training products of experts by minimizing contrastive divergence. *Neural Computation*. 2002;14(8):1771–1800. doi: 10.1162/089976602760128018. [PubMed] [Cross Ref]

17. Tieleman T. Training restricted boltzmann machines using approximations to the likelihood gradient. Proceedings of the 25th International Conference on Machine Learning; July 2008; pp. 1064–1071.

18. Salakhutdinov R. R. Learning in markov random fields using tempered transitions. Proceedings of the Advances in Neural Information Processing Systems, NIPS '09; December 2009; pp. 1598–1606.

19. Tieleman T., Hinton G. E. Using fast weights to improve persistent contrastive divergence. Proceedings of the 26th Annual International Conference on Machine Learning (ICML '09); June 2009; Montreal, Quebec, Canada. ACM; pp. 1033–1040.

20. Salakhutdinov R. Learning deep boltzmann machines using adaptive MCMC. Proceedings of the 27th International Conference on Machine Learning, ICML '10; June 2010; Haifa, Israel. DBLP; pp. 943–950.

21. Bengio Y. *Neural Networks: Tricks of the Trade*. 2nd. Vol. 7700. Berlin, Germany: Springer; 2012. Practical recommendations for gradient-based training of deep architectures; pp. 437–478. (Lecture Notes in Computer Science). [Cross Ref]

22. Courville A., Bergstra J., Bengio Y. A spike and slab restricted boltzmann machine. *Journal of Machine Learning Research, AISTATS*. 2011;15:233–241.

23. Côté M.-A., Larochelle H. An infinite restricted boltzmann machine. *Neural Computation*. 2016;28(7):1265–1288. doi: 10.1162/NECO_a_00848. [PubMed] [Cross Ref]

24. Hinton G. A practical guide to training restricted boltzmann machines. *Momentum*. 2010;9(1, article 926) doi: 10.1007/978-3-642-35289-8_32. [Cross Ref]

25. Gonzalez R. C., Wintz P. *Digital Image Processing*. Boston, Mass, USA: Addison-Wesley Publishing Co., Inc.; 1977.

Articles from Computational Intelligence and Neuroscience are provided here courtesy of **Hindawi**

PubMed Central Canada is a service of the Canadian Institutes of Health Research (CIHR) working in partnership with the National Research Council's national science library in cooperation with the National Center for Biotechnology Information at the U.S. National Library of Medicine(NCBI/NLM). It includes content provided to the PubMed Central International archive by participating publishers. |