text:
\section{Introduction}

Convolutional neural network (CNN) is an effective method to solve the computer vision tasks~\cite{krizhevsky2012imagenet,simonyan2014very,he2016deep}. Furthermore, combining it with attention mechanisms can better solve them~\cite{chen2017sca,wang2017residual,yang2016stacked,nguyen2018attentive}, such as channel-wise attention networks~\cite{hu2018squeeze,li2018harmonious,hu2018gather,woo2018cbam,zhu2019stacked}. They usually use Global Average Pooling (GAP) to squeeze the entire feature map into a descriptor~\cite{hu2018squeeze,hu2018competitive,li2018harmonious,woo2018cbam}. However, GAP tends to ignore the detail area in feature map with lower magnitude, which easily leads to the homogeneity of the channel descriptors. To alleviate this problem, some researchers combine channel-wise attention with spatial attention to make the attention module to pay attention to the spatial details of the feature map~\cite{li2018harmonious,linsley2018global}. And some researcher even design a 3D-like attention module to extract the channel descriptors with spatial information~\cite{hu2018gather}. However, these methods bring a lot of additional parameters and computational consumption. Therefore, it is expected that the attention mechanism is paid attention to the details of feature maps under the framework of the channel-wise attention mechanism but with only a little additional cost.

This paper attempts to improve the representation of descriptors extracted by GAP through providing the feature maps with higher quality. The proposed method is called as Stochastic Region Pooling (SRP), which does not brings extra parameters and computation in test phase. SRP emphasizes more local features in the convolutional layer, making the channel descriptors extracted by GAP more representative and thus making the channel-wise attention mechanism works better. In more details, it stochastically selects the region from the feature map and used GAP to obtain the region descriptor, where the descriptor is the accurate representation of the region. Subsequently, the region descriptors are used in the follow-up attention structure. In such case, the back propagation~\cite{lecun1989backpropagation} will encourage these regions to have more important feature responses to represent its original entire feature map.

This paper proposes a simple method to implement SRP, named as Single Square SRP (SS-SRP), which stochastically selects a single square region from feature map to extract the descriptor. In order to consider local response of irregular shape in feature map, another method named as  Multiple Squares SRP (MS-SRP) is proposed that stochastically selects multiple square regions from the feature map and then extracts the descriptor from their union regions. These two methods are illustrated in figure.\ref{fig:1}. On the other hand, in residual networks, most of attention mechanisms only act on the residual branch of residual block. In order to make the feature maps of identity branch also have more feature responses, we use SRP to extract the channel descriptors of both identity branch and residual branch, which are then applied to serve the follow-up attention structure. The main contributions are as follows:
\begin{figure*}
\centering
  \includegraphics[width=16cm]{O_D_srp_structure_new}
  \caption{The framework of Stochastic Region Pooling (SRP) with applications to one branch or double branch attention block, where SS-SRP and MS-SRP are considered.}
  \label{fig:1}
\end{figure*}
\begin{itemize}
\item A new method SRP is proposed that make more local regions in the feature map to have more important feature responses, so that the channel descriptors extracted later by GAP are more representative and robust.
\item SRP obtains the significant improvement of the performance for one branch or double branch block of channel-wise attention structures without any additional parameters and computation in test phase. It can also work well with some augmentation methods to further improve the performance.
\item A linear strategy is proposed to make SRP work well that gradually reduces the scale ratio of region as the depth of the layer increases.
\item Experiments are conducted on serval datasets, including CIFAR-10/100, ImageNet and three Fine-grained datasets (CUB-200-2011, Stanford Cars and Stanford Dogs), which verified the effectiveness of SRP.
\end{itemize}

\begin{algorithm*}
\KwIn{Feature map:$U$, height and width of the feature map: $H$ and$W$, scale ratio:$\lambda$, the number of square regions:$M$, $mode$. }
\KwOut{The channel descriptors $z$ ($z_c$ is the $c^{th}$ channel descriptor of $z$).}
\If{$mode$ != $Training Stage$}{
$\forall c : z_c=F_{sq}(u_c) \qquad \qquad \qquad \qquad \rhd {F}_{sq}$ computes Eq.~\eqref{eqn:01}\;

	return $z$\;
	}
Calculate the height and width of square region: $H'=\lfloor \lambda H + \frac{1}{2}\rfloor, W'=\lfloor \lambda W + \frac{1}{2}\rfloor$\;

Stochastically sample $M$ positions $P^m_{i,j}$ from the feature map $U$ where $1\leq i \leq H-H'+1$, $1\leq j \leq W-W'+1$\;

Crop $M$ square regions from the feature map $U$ with the left-top position as $P^m_{i,j}$, where the width and height of square region are $W'$ and $H'$\ respectively;
$\forall c: {z}_c={F^{\*}}_{sq}(u_c,P_{i,j},H',W') \qquad \qquad  \rhd {F^{\*}}_{sq}$ computes Eq.~\eqref{eqn:04} or Eq.~\eqref{eqn:06}\;
return ${z}$\ ;
\caption{Stochastic Region Pooling}
\label{alg:one}
\end{algorithm*}

\section{Related Work}

\noindent\textbf{Improving representation of feature maps}.$\quad$ A common way to obtain high-quality feature maps is to find efficient network structures, such as~\cite{simonyan2014very, szegedy2015going, he2016deep,huang2017densely,yang2018convolutional} to extract more and better features. However, the feature maps learned by these networks are still not diverse enough. Another way is regularization. Some regularization for channel can maintain high quality channels by removing or retraining the inefficient channels ~\cite{he2017channel,zhang2016picking,gao2018dynamic,hou2019Weighted}. For ~\cite{he2017channel,zhang2016picking}, they will change the network structure. And for ~\cite{gao2018dynamic,hou2019Weighted}, we have not found the evidence to prove that they are suitable for channel-wise attention neural networks. Other regularizations such as dropout~\cite{srivastava2014dropout}, droppath~\cite{larsson2017fractalnet}, dropblock~\cite{ghiasi2018dropblock}, cutout~\cite{devries2017improved} can enhance the robustness of the feature by introducing randomness. And our method is closely related to Dropblock~\cite{ghiasi2018dropblock} which drops spatially correlated information to promote the network to reconstruct the important features from its surrounding.
However, our method is aims to solve the problem that the descriptor in the channel-wise attention network contains few detailed information of the feature map, such as by promoting the feature map to have more or wider important feature responses.

\noindent\textbf{Extracting descriptors by spatial feature pooling}.$\quad$ The idea of spatial feature pooling was proposed by Hubel and Wiesel~\cite{hubel1962receptive}, and then Yann Lecun~\cite{lecun1998gradient} successfully applied it to CNN. Furthermore, Spatial Pyramid Matching(SPM)~\cite{lazebnik2006beyond,yang2009linear} manually designed the pooling weights to obtain spatial feature pyramid,  Malinowski~\cite{malinowski2013learning} parameterized pooling operator to learn the pooling regions, and Lee~\cite{lee2016generalizing} combined the max pooling and the average pooling to obtains a generalized pooling function. Some researchers also use the second-order pooling even the third-order pooling instead of the first-order pooling (i.e., GAP) to collect richer statistics of the last convolution layer in CNN~\cite{cui2017kernel,lin2015bilinear,wang2018global}. Introducing randomness can also improve the performance of spatial pooling. For example, stochastic pooling~\cite{zeiler2013stochastic} randomly selects the activation value based on a multinomial distribution formed by activations of each pooling region to regularize the network, and S3Pool~\cite{zhai2017s3pool} randomly picks feature map's rows and columns and then performs the max pooling operation to implicitly introduce data augmentation. However, using the above method to extract the channel descriptor will bring a lot of extra consumption, or it will still not make the descriptor's representation stronger. We select a simplest way, which takes GAP to extract the descriptor because it is widely used, does not bring any extra parameters, and has the potential to get global spatial information.

\noindent\textbf{Methods of spatial pooling in attention mechanism}.$\quad$ Channel-wise attention mechanisms have developed rapidly in recent years~\cite{nguyen2018attentive,chen2017sca,li2018harmonious,hu2018squeeze,hu2018gather,woo2018cbam} and the channel descriptors are crucial to them.
In order to extract more representative descriptors, CBAM~\cite{woo2018cbam} combines the output of the global max pooling and the global average pooling as the pooling method, and GEnet~\cite{hu2018gather} uses the depth-wise convolution with large kernel to replace GAP.
However, the global max pooling in CBAM is prone to network overfitting~\cite{zeiler2013stochastic}, and CBAM also cannot enhance the channel descriptor with more spatial details. Besides, GENet will brings a lot of additional parameters or computation.
Different from them, SRP is a training method that can encourage the descriptors to have more information about the feature map details. The reason why SRP uses GAP instead of the above methods to extract the descriptor is not only because GAP is simple and does not bring any additional parameters, but also that GAP is widely used for attention networks. This enables SRP to be conveniently used on these networks without modifying the network structure.

\section{Stochastic Region Pooling}
Many channel-wise attention block applied GAP operation to obtain the descriptor of feature map. Formally, given the feature maps $U=[u_1,u_2,\cdots,u_c]\in \mathbb{R}^{H\times W\times C}$ in the convolutional layer and the function $S(\cdot)$ squeezes the global spatial information into a channel descriptor $z = [z_1,z_2,\cdots,z_C]\in R^{C}$, the $c^{th}$ channel descriptor of $z$ can be calculated in GAP by
\begin{equation}
\label{eqn:01}
z_c=S(u_c)=\frac{1}{H\times W}\sum^{H}_{i=1}\sum^{W}_{j=1}u_c(i,j).
\end{equation}

From the Eq.\ref{eqn:01}, it can be concluded that GAP regards each position of the space to make the same contribution, even if the elements of some local regions have the low magnitude~\cite{zeiler2013stochastic}. This will weaken the details of the feature map and easily leads to high similarity between descriptors. Here we propose Stochastic Region Pooling (SRP) method that stochastically selects the region from the feature map instead of the whole map to extract descriptors during the training stage. SRP is presented as Algorithm ~\ref{alg:one}.

\textbf{SS-SRP} is a simple method to be implemented, which stochastically selects a single square region from map. Supposing that the scale ratio $\lambda$ controls the size of square region, the width and height of the square region can be formulated as follows,
\begin{equation}
\label{eqn:03}
H'=\lfloor \lambda H + \frac{1}{2}\rfloor, W'=\lfloor \lambda W + \frac{1}{2}\rfloor.
\end{equation}
For each feature map, we stochastically select a position $P(a,b)$ as the upper left corner of the square region $R\in \mathbb{R}^{H'\times W'}$, where the spatial position $P(a,b)$ subject to $1\leq i \leq H-H'+1$, $1\leq j \leq W-W'+1$.
Now we use the average pooling as the squeeze operator $S(\cdot)$ to extract the descriptors $z$, and the $c^{th}$ channel descriptor of $z$ can be calculated by
\begin{equation}
\label{eqn:04}
{z}_c=S(u_c)=\frac{1}{H'\times W'}\sum^{a+H'-1}_{i=a}\sum^{b+W'-1}_{j=b}u_c(i,j).
\end{equation}
The module of SS-SRP can be seen in the Figure \ref{fig:1}.

\textbf{MS-SRP} is applied to consider the non-regular shape of the local region in feature map, which stochastically selects multiple square regions from the feature map and then extracts the descriptor from their union regions. Suppose that we stochastically choose $M$ square regions from the feature map, defined as  $R \in \mathbb{R}^{M\times H\times W}$, the target region we want is their union area $R^{*}$.

Let $\Omega^{*}$ be the set of all the points in $R^{*}$ and $\Omega_m$ be the set of all points in the $m^{th}$ square region $R_m$, we have
\begin{equation}
\label{eqn:05}
\Omega^{*}= \bigcup_{m = 1}^{M} \Omega_m=\bigcup_{m = 1}^{M} \big\{(x,y)\mid(x,y)\in \Omega_m\big\}.
\end{equation}

The global average pooling is used as we did before to squeeze the regional spatial information. Thus the $c^{th}$ channel descriptor of $z$ can be calculated by
\begin{equation}
\label{eqn:06}
{z}_c=S(u_c,\Omega^{*})=\frac{1}{\mid\Omega^{*}\mid}\sum_{(i,j)\in \Omega^{*}}u_c(i,j),
\end{equation}
where $\mid\Omega^{*}\mid$ is the number of elements in $\Omega^{*}$,i.e. the number of points in region $R^{*}$. The module of MS-SRP can be seen in the Figure \ref{fig:1}.

\noindent\textbf{One branch or double branch attention block.}
\label{sec:3}
After calculating the channel descriptors, a one branch attention block applies an excitation operation $T^{O}(\cdot)$ to obtain the relationship $\mathbb{\alpha}\in \mathbb{R}^{C}$ between the channels of the residual branch, which is $\alpha=T^{O}\big(z^r)$ where $z^r$ is the channel descriptor of the residual branch. And a double branch attention block utilizes $T^{D}(\cdot,\cdot)$ to compute the relationship among channels of the residual branch, which is $\alpha=T^{D}\big(z^{id},z^{r})$, where $z^{id}$ and $z^{r}$ are the channel descriptors of the identity branch and the residual branch respectively.

For the one branch attention block, we use two fully connected(FC) layers as the function $T^{O}\big(z^r)$ as described in SENet~\cite{hu2018squeeze}. For the double branch attention block, we fold two branch's descriptors and use convolution $3\times 3$ to model their relationship as the function $T^{D}\big(z^{id},z^{r})$ as described in CMPE-SENet~\cite{hu2018competitive}.

Finally, these recalibrated feature maps $\widetilde{U}\in \mathbb{R}^{H\times W \times C}$ can be calculated by $\widetilde{U}= \alpha \cdot U$, where $\cdot$ is the element-wise multiplication.

\noindent\textbf{Scheduled SRP.}$\quad$ The neurons in the shallow layers of the network have smaller receptive field. In order to maintain a majority of responses in the region selected by SRP in the shallow layers, we gradually reduce $\lambda$ from 1 to the smaller value as the depth of the layer increases, instead of setting $\lambda$ to a fixed value. In our experiments, we use linear strategy to reduce  $\lambda$, which is inspired by ScheduledDropPath~\cite{zoph2018learning}, but ScheduledDropPath changes its parameters over training time.

\section{Experiments}

Some experiments are conducted to validate the proposed method on the CIFAR-10/100\cite{krizhevsky2009learning}, ImageNet\cite{ILSVRC15}, and three fine-grained datasets (CUB-200-2011\cite{wah2011caltech}, Stanford Dogs\cite{khosla2011novel} and Stanford Cars\cite{krause20133d}). For experiments on CIFAR and fine-grained datasets, we report the average accuracy by running five times, while on ImageNet, we report the average accuracy by doing three times due to the limitation of computational resources. In the following subsections, SRP-O indicates that SRP is applied to the one branch attention block, and SRP-D indicates that SRP is applied to the double branch attention block.

\subsection{Experiment Settings}

\begin{table
\begin{minipage}{\columnwidth}
\begin{center}
\scalebox{1}{
\begin{tabular}{lccc}
  \toprule
Datasets		& \#Class	& \#Train	& \#Test \\
  \midrule
CUB-200-2011	& 200		& 5,994		& 5,794	\\
Stanford Cars	& 196		& 8,144		& 8,041	\\
Stanford Dogs	& 120		& 12,000	& 8,580	\\
  \bottomrule
\end{tabular}}
\end{center}
\end{minipage}
\caption{Statistics	of three common Fine-grained datasets.}
\label{tab:1}
\end{table}%

\begin{figure
\centering
\includegraphics[width=4cm]{lambda_ss_srp_o_wrn2810_cifar100}
\includegraphics[width=4cm]{lambda_ss_srp_d_wrn2810_cifar100}
\includegraphics[width=4cm]{lambda_ss_srp_o_res110_cifar100}
\includegraphics[width=4cm]{lambda_ss_srp_d_res110_cifar100}
\caption{Testing acc (\%) of SS-SRP (with or without scheduled) applied to One or Double branch block on CIFAR-100 data with the different $\lambda$.}
\label{fig:2}
\end{figure}

\begin{figure
\centering
\includegraphics[width=4cm]{heatmap_SRP-O-WRN-28-10_cifar100_number_nocbar}
\includegraphics[width=4cm]{heatmap_SRP-D-WRN-28-10_cifar100_number_nocbar}
\caption{Test acc (\%) of MS-SRP applied to One or Double Branch block on CIFAR-100 dataset under different hyperparameters ($\lambda, M$).}
\label{fig:3}
\end{figure}
\noindent\textbf{CIFAR.} Following ~\cite{he2016identity,Zagoruyko2016WRN,xie2017aggregated}, we use stochastic gradient descent (SGD) with 0.9 Nesterov momentum and batchsize of 128. The learning rate is set to be 0.1, which is then divided by 10 at epochs 100, 150 for ResNet, divided by 5 at epochs 60,120,160 for WRN, and divided by 10 at epochs 150,225 for ResNeXt. We train the model by 200 epochs for ResNet and WRN, and 300 epochs for ResNeXt. The weight decay is 0.0001 for ResNet, 0.0005 for WRN and ResNeXt. we use the standard data augmentation (translation/mirroring) for the training sets.

\noindent\textbf{ImageNet.} The ILSVRC 2012 contains 1.2 million training images and 50K validation images with 1K classes. We adopt the standard data augmentation for the training sets, which randomly samples a 224$\times$224 crop from the original images or their horizontal flip, and applies a single-crop with the size 224$\times$224 at testing stage. We train our models for 100 epochs and drop the learning rate by 0.1 at epoch 30, 60, and 90, and use SGD with the mini-batch size of 256 on 4 GPUs (64 each). The weight decay is 0.0001 and Nesterov momentum is 0.9. In experiments, we report the classification accuracy on the validation set.

\noindent\textbf{Fine-grained Datasets.} We conduct experiments on three fine-grained datasets, including CUB-200-2011,Stanford Dogs and Stanford Cars. The detailed statistics of each dataset are shown in Table \ref{tab:1}. For all fine-grained datasets, we resize the input images to 512$\times$512 and randomly crop the smaller images with 448$\times$448 from it, and then generates the horizontal flip of the cropped images for training. At the testing stage, we only use a single cropped image with 448$\times$448 from the input image which have been resized to 512$\times$512. We fine-tune networks (pre-trained on ImageNet) using SGD with the batch size of 16, momentum of 0.9 and weight decay of 0.00001. For all fine-grained datasets, we train the networks for 90 epochs. The learning rate begins with 0.001 and then divided by 10 at epoch 30 and 60.

\subsection{Impact of Hyper-parameters}

In order to demonstrate the influence of two hyper-parameters (scale ratio $\lambda$ and the square regions number $M$) on the performance of our model, experiments are conducted on CIFAR-100, where SRP applied on attention networks with different hyper-parameter settings.

\noindent\textbf{SS-SRP}. It only randomly selects one square region, which becomes standard mothod when we set $\lambda=1$. It can be seen from figure \ref{fig:2} that an appropriate $\lambda$ can improve the network performance and the lower $\lambda$ will result in the poor results. In the following experiments of SS-SRP, we use $\lambda=0.8$ unless specified elsewhere, because SS-SRP obtains the better results at $\lambda=0.8$.
From figure \ref{fig:2}, it can be also observed that SRP with the fixed scale ratio $\lambda$ can effectively improve the network performance, but the scheduled SRP makes the network work better. In all following experiments of SRP, scheduled SRP is used.

\noindent\textbf{MS-SRP}. In MS-SRP, there are two hyper-parameters that affects the network performance, i.e., the scale ratio $\lambda$ and the square number $M$. By observing the results in figure \ref{fig:3}, MS-SRP outperforms standard method SRP (i.e., $\lambda=1$) and SS-SRP within a wider range of hyper-parameters. Since $\lambda=0.6$ and $M=5$ can obtain the better results, we use these hyper-parameters for all experiments of MS-SRP unless stated elsewhere.

\begin{table
\centering
\scalebox{0.75}{
\begin{tabular}{lcccccc}
  \toprule
  Model 																& depth 	& params	 & C10 			& C100	\\
  \midrule
  FractalNet~\cite{larsson2017fractalnet}								& 21		& 38.6M			& 95.40			& 76.27	\\
  WRN-28-10~\cite{Zagoruyko2016WRN}										& 28		& 36.5M			& 96.00			& 80.75 \\

  ResNeXt-29(8x64d)~\cite{xie2017aggregated}						    	& 29		& 34.4M			& 96.35 			& 82.23 \\
  ResNeXt-29(16x64d)~\cite{xie2017aggregated}						    & 29		& 68.1M			& 96.42 			& 82.69 \\

  DenseNet(k=24)~\cite{huang2017densely}									& 100		& 27.2M			& 96.26 			& 80.75	\\
  DenseNet-BC(k=40)~\cite{huang2017densely}								& 190		& 25.6M			& 96.54			& 82.82	\\
  PyramidNet(bottleneck,$\alpha=270$)~\cite{han2017deep}					& 272		& 27.0M			& 96.52			& {\color{red}{82.99}}	\\
  \midrule
  \textit{mixup}~\cite{zhang2017mixup}, WRN-28-10~\cite{Zagoruyko2016WRN} & 28		& 36.5M			& 97.30		& 82.50 \\
  \textit{mixup}~\cite{zhang2017mixup}, DenseNet-BC(k=40)~\cite{huang2017densely} & 190	& 25.6M			& 97.30			& 83.20 \\
  \textit{mixup}~\cite{zhang2017mixup}, SE-WRN-28-10~\cite{hu2018squeeze} & 28		& 36.8M			& 97.32			& 83.23 \\
  \midrule
  \textbf{SS-SRP-O}, WRN-28-10 							& 28		& 36.8M			& 96.28			& 81.38		\\
  \textbf{SS-SRP-O}, ResNeXt-29(8x64d) 					& 29		& 34.9M			& 96.52			& 82.59	\\
  \textbf{SS-SRP-D}, WRN-16-8 							& 16		& 11.1M			& 96.02			& 80.89		\\
  \textbf{SS-SRP-D}, WRN-28-10 							& 28		& 36.9M			& 96.50			& 81.78		\\
  \midrule
  \textbf{MS-SRP-O}, WRN-28-10 							& 28		& 36.8M			& 96.34			& 81.38		\\
  \textbf{MS-SRP-O}, ResNeXt-29(8x64d) 					& 29		& 34.9M			& 96.53			& \textbf{82.62}	\\
  \textbf{MS-SRP-D}, WRN-16-8 							& 16		& 11.1M			& 96.10 	 	& 80.98	\\
  \textbf{MS-SRP-D}, WRN-28-10 							& 28		& 36.9M			& {\color{red}{96.61}} & 81.91		\\
  \midrule
  \textbf{MS-SRP-O}, \textit{mixup}, WRN-28-10 			& 28		& 36.8M			&  97.48				& 84.08	 	 	\\
  \textbf{MS-SRP-D}, \textit{mixup}, WRN-16-8 			& 16		& 11.1M			&  96.84				& 82.71 	 	\\
  \textbf{MS-SRP-D}, \textit{mixup}, WRN-28-10 			& 28		& 36.9M			& {\color{red}{97.56}}	 & {\color{red}{84.12}}	 	\\
  \bottomrule
\end{tabular}}
\caption{Comparison of test accuracy (\%) with different methods on the CIFAR-10 and CIFAR-100.  The best results are highlighted in {\color{red}{red}}, and the best records of our models are in \textbf{bold}. Combined with the augmentation method of \textit{mixup}~\cite{zhang2017mixup}, SRP can challenge state-of-the-art results.}
\label{tab:2}
\end{table}%

\begin{table
\begin{minipage}{\columnwidth}
\begin{center}
\scalebox{0.8}{
\begin{tabular}{lccc }
  \toprule
  Model 														& params  	& top-1		& top-5  \\
  \midrule
  CliqueNet-S3~\cite{yang2018convolutional}						& 14.4M 	& 75.95		& 92.85	\\
  ResNet-50~\cite{he2016deep}										& 25.6M		& 75.30		& 92.20	\\
  ResNet-101~\cite{he2016deep}									& 44.6M		& 76.40		& 92.90	\\
  SE-ResNet-50~\cite{hu2018squeeze}								& 28.1M		& 76.71		& 93.38	\\
  ResNet-152~\cite{he2016deep}									& 28.1M		& 77.00		& 93.30	\\
  DenseNet-201~\cite{huang2017densely}							& 20.2M		& 77.42      & 93.66 \\
  SE-ResNet-101~\cite{hu2018squeeze}								& 49.4M		& 77.62		& 93.93	\\

  CBAM-ResNet-50~\cite{woo2018cbam}								& 25.9M		& 77.34		& 93.69	\\
  GE-$\theta^+$-ResNet-50~\cite{hu2018gather}						& 33.7M		& \textbf{78.12} & 94.20	\\

  \midrule
  \textbf{SS-SRP-O}-ResNet-50									& 28.1M		& 77.43		& 93.81	\\
  \textbf{MS-SRP-O}-ResNet-50									& 28.1M		& 77.58		& 93.88	\\
  \textbf{SS-SRP-D}-ResNet-50									& 29.2M		& 77.94		& 94.35	\\
  \textbf{MS-SRP-D}-ResNet-50									& 29.2M		& 78.09		& \textbf{94.40}	\\
  \bottomrule
\end{tabular}}
\end{center}
\end{minipage}
\caption{Comparison of test accuracy (\%) between SRP and other different methods on the large ImageNet, where a single crop method is applied.}
\label{tab:3}
\end{table}%

\begin{table*
\centering
\begin{minipage}[b]{0.7\columnwidth}
\scalebox{0.7}{
\begin{tabular}{lccc }
  \toprule
  Model 												& Anno.		 & 1-Stage		& Acc. 		\\
  \midrule
  DVAN~\cite{zhao2017diversified}						& $\times$ 	 & $\times$		& 79.0		\\

  Part-RCNN~\cite{zhang2014part}							& \checkmark & $\times$		& 81.6 		\\
  PA-CNN~\cite{krause2015fine}							& \checkmark & \checkmark	& 82.8 		\\
  RAN~\cite{wang2017residual}							& $\times$	 & $\times$		& 82.8 		\\

  FCAN~\cite{liu2016fully}								& \checkmark & \checkmark	& 84.7 		\\
  RACNN~\cite{fu2017look}								& $\times$	 & $\times$		& 85.3 		\\
  \midrule
  VGG-19~\cite{simonyan2014very}							& $\times$ 	 & \checkmark	& 77.8		\\
  ResNet-50~\cite{he2016deep}							& $\times$   & \checkmark	& 81.7  	\\

  DenseNet-161~\cite{huang2017densely}					& $\times$   & \checkmark	& 84.2  	\\
  FCAN~\cite{liu2016fully}								& $\times$	 & \checkmark	& 84.3 		\\
  ResNet-101~\cite{he2016deep}							& $\times$   & \checkmark	& 84.5  	\\

  \midrule
  \textbf{SS-SRP-D}-ResNet50						& $\times$	 & \checkmark	& 84.9		\\
  \textbf{MS-SRP-D}-ResNet50						& $\times$	 & \checkmark	& \textbf{85.6}		\\
  \bottomrule
\end{tabular}}
\subcaption{CUB-200-2011.}
\label{tab:4a}
\end{minipage}\begin{minipage}[b]{0.7\columnwidth}
\scalebox{0.7}{
\begin{tabular}{lccc }
  \toprule
  Model 												& Anno.		 & 1-Stage		& Acc. 		\\
  \midrule
  DVAN~\cite{zhao2017diversified}													& $\times$ 	 & $\times$		& 87.1		\\
  RAN~\cite{wang2017residual}										 			& $\times$	 & $\times$		& 91.0 		\\
  FCAN~\cite{liu2016fully}													& \checkmark & \checkmark	& 91.3 		\\
  RACNN~\cite{fu2017look}													& $\times$   & $\times$		& 92.5  	\\
  PA-CNN~\cite{krause2015fine}												& \checkmark & \checkmark	& \textbf{92.8} 		\\
  \midrule
  VGG-19~\cite{simonyan2014very}												& $\times$ 	 & \checkmark	& 84.9		\\
  FCAN~\cite{liu2016fully}													& $\times$	 & \checkmark	& 89.1 		\\
  ResNet-50~\cite{he2016deep}													& $\times$   & \checkmark	& 89.8  	\\

  DenseNet-161~\cite{huang2017densely}												& $\times$   & \checkmark	& 91.8  	\\
  ResNet-110~\cite{he2016deep}												& $\times$   & \checkmark	& 91.9  	\\

  \midrule
  \textbf{SS-SRP-D}-ResNet50						& $\times$	 & \checkmark	& 92.3		\\
  \textbf{MS-SRP-D}-ResNet50						& $\times$	 & \checkmark	& \textbf{92.8}		\\
  \bottomrule
\end{tabular}}
\subcaption{Stanford Cars.}
\label{tab:4b}
\end{minipage}\begin{minipage}[b]{0.7\columnwidth}
\scalebox{0.7}{
\begin{tabular}{lccc }
  \toprule
  Model 												& Anno.		 & 1-Stage		& Acc. 		\\
  \midrule
   DVAN~\cite{zhao2017diversified}													& $\times$ 	 & $\times$		& 81.5		\\
  RAN~\cite{wang2017residual}										 			& $\times$	 & $\times$		& 83.1 		\\

  \midrule
  VGG-16~\cite{simonyan2014very}												& $\times$ 	 & \checkmark	& 76.7		\\
  ResNet-50~\cite{he2016deep}												& $\times$   & \checkmark	& 81.1  		\\
  DenseNet-161~\cite{huang2017densely}											& $\times$   & \checkmark	& 81.2  		\\

  FCAN~\cite{liu2016fully}													& $\times$	 & \checkmark	& 84.2 		\\
  MAMC-ResNet50~\cite{sun2018multi}  										& $\times$	 & \checkmark	& 84.8 		\\
  ResNet-101~\cite{he2016deep}												& $\times$   & \checkmark	& 84.9  		\\
  \midrule
  \textbf{SS-SRP-D}-ResNet50					& $\times$	 & \checkmark	& 85.9			\\
  \textbf{MS-SRP-D}-ResNet50					& $\times$	 & \checkmark	& \textbf{86.3}		\\
  \bottomrule
\end{tabular}}
\subcaption{Stanford Dogs.}
\label{tab:4c}
\end{minipage}
\caption{Comparison results on three Fine-grained datasets including CUB-200-2011, Stanford Cars and Stanford Dogs. "Anno." represents using extra annotation in training. "1-Stage" represents whether the training can be done in one stage. "Acc." represents the test set accuracy (\%)}
\label{tab:4}
\end{table*}%

\begin{figure
\centering
  \includegraphics[width=8cm]{grad_cam_figure}
  \caption{In \textbf{ImageNet}, the Grad-CAM~\cite{selvaraju2017grad} visualization for double branch block of attention ResNet50 model trained without SRP and trained with SRP. Best viewed in color.}
  \label{fig:4}
\end{figure}

\subsection{CIFAR Classification}

Table \ref{tab:2} presents the results of SRP and compared state-of-the-art CNN architectures on CIFAR. It can be observed that SRP method consistently achieve the better effective performance when applied it to other networks. Furthermore, the small network trained with SRP can achieve the comparable accuracy to some larger models, such as MS-SRP-O-ResNext-29 (34.9M) vs ResNext-29 (68.1M)~\cite{xie2017aggregated}, MS-SRP-D-WRN-16-8 (11.1M) vs DenseNet (27.2M)~\cite{huang2017densely} or WRN-28-10 (36.5M)~\cite{Zagoruyko2016WRN}. On the other hand, SRP may further improve network performance when augmentation methods are applied, such as \textit{mixup}~\cite{zhang2017mixup}. Combined with \textit{mixup} in the training stage, MS-SRP-D surpasses all the comparison methods, and can challenge state-of-the-art results.

\subsection{ImageNet Classification}

We next investigate the effectiveness of SRP on large dataset, the  ILSVRC 2012 dataset.

\noindent\textbf{Comparison with state-of-the-arts CNNs.}
It can be observed from Table \ref{tab:3} that SRP can still improve the network performance effectively on the large data sets and achieved very competitive accuracy. For example, it exceeds all the methods in terms of top-5 accuracy, while it is much close to the state-of-the-art method by top-1. For SE-ResNet-50, the accuracy improvement of SRP is 0.87\% on top-1 and 0.5\% on top-5. And the best result of SRP surpasses the basic ResNet-50 and SE-ResNet-50 more than 2\% and 1\% respectively, by both top-1 and top-5. Compared with the GE-$\theta^+$~\cite{hu2018gather}, SRP can achieve comparable or better performance but obviously uses fewer parameters. Moreover, compared with the counterparts, SRP can achieve higher accuracy by top-5 while their accuracy are similar by top-1. This is because SRP promotes the feature maps to contain more features response, making the network have better generalization ability.

\noindent\textbf{SRP learns more and wider regions.} The model trained with SRP will promote more local feature responses in the convolutional layer, making the network focus on the more and wider regions. Here, we use Grad-CAM~\cite{selvaraju2017grad} to visualize the importance of the spatial position in the convolutional layer. The visualization results of SRP networks (SS-SRP-D-ResNet50, MS-SRP-D-ResNet50) and the baseline (ResNet50 with double branch attention block) can been seen in Figure \ref{fig:4}. It can be clearly observed that the Grad-CAM masks of SRP cover the target object better and wider than the baseline. That is, the model trained with SRP tends to focus on several spatially distributed regions, and aggregate information from multiple or wider regions.

\begin{figure*
\centering
  \includegraphics[width=16cm]{channels_three_figure}
  \caption{The feature maps of ResNet-50 with different mode. D-ResNet means ResNet-50 with double branch attention block. SRP-O-ResNet and SRP-D-ResNet means ResNet-50 with one or double branch attention block and train with MS-SRP. These feature maps are from the residual branch or identity branch of the 14th block of the network. We only display the first 20 feature maps. Best viewed in color.}
\label{fig:5}
\end{figure*}
\subsection{Fine-Grained Classification}

The difficulty of fine-grained classification tasks is that even with different categories of objects, they are still very similar. This requires the network to have the ability to learn multiple and more accurate region features. In this section, we investigate the performance of SRP on fine-grained classification tasks.

We first analyze the results on CUB-200-2011 dataset, as shown in Table \ref{tab:4a}. Our method achieves strong performance with ResNet-50, which surpasses some deeper or larger network such as DenseNet-161~\cite{huang2017densely} or ResNet-110~\cite{he2016deep} more than 1\%. Also, compared with the method using extra annotation (FCAN~\cite{liu2016fully}), the method using multiple training stage (Part-RCNN~\cite{zhang2014part}), and the method using both extra annotation and multi-stage (RACNN~\cite{fu2017look}), our method outperforms them by 0.9\%, 4.0\% and 0.3\% respectively.

Our method also obtains the good performance on the Stanford Cars and Stanford Dogs, as shown in both Table \ref{tab:4b} and Table \ref{tab:4c}. On Stanford Cars, SRP outperforms all the comparison methods, except PA-CNN that uses extra annotation. On Stanfor Dogs, SRP surpasses the best result of other methods about 1.4\% in Table \ref{tab:4c}. Also, SRP outperforms its deeper or larger counterparts such as ResNet-110 and DenseNet-161 by about 1.0\% on Stanford Cars and 3.3\% on Stanford Dogs averagely. Furthermore, on these two datasets, SRP exceeds the efficient methods like DVAN~\cite{zhao2017diversified} and RAN~\cite{wang2017residual} by about 5.2\% and 2.5\% respectively, while DVAN and RAN both use extra annotation and multi-stage.

These facts indicate that SRP can obtain the significant improvement on fine-grained datasets, which even challenge the state-of-the-art results. It is worth mentioning that our method is a general method for the attention mechanisms. It may further improve the classification accuracy by combining with the better base network or some methods which are specifically for the fine-grained image classification.

\section{Discussion and Analysis}

\begin{figure
\centering
  \includegraphics[width=8.3cm]{cub_grad_figure}
  \caption{In \textbf{Fine-Grained} dataset, the Grad-CAM~\cite{selvaraju2017grad} visualization datasets for double branch block of attention ResNet50 model trained without SRP, trained with MS-SRP($M=5,\lambda=0.6$), and trained with MS-SRP$^*$($M=5,\lambda=0.2$). It indicates that SRP can promote the network to learn more detailed features of object, while SRP with too smal $\lambda$ will make the network pay attention to some unimportant fragment regions. Best viewed in color.}
  \label{fig:6}
\end{figure}

\noindent\textbf{Scheduled SRP.} The results in figure \ref{fig:2} shows that the scheduled SRP is superior to SRP with fixed $\lambda$ within a wide range of hyper-parameters. This indicates that the scheduled SRP is effective and practical. The possible reason is that the receptive field of shallow neurons in CNN are small. When SRP takes the fixed $\lambda$, the attention mechanism will receive a over-fragmented information about the feature map in shallow layer, which will in turn disturb the learning of the attention mechanism. Scheduled SRP avoided this problem by reducing $\lambda$ from 1 to the target value as the depth of layer increases.

\noindent\textbf{Feature maps analysis.} The purpose of SRP is to improve the representation of channel descriptors by increasing or widening the important responses in the feature map. Hence we output some feature maps of SRP-O-ResNet, SRP-D-ResNet and D-ResNet to analyze the effects of SRP visually, as shown in Figure \ref{fig:5}. For SRP-O-ResNet, SRP only acts on the residual branch. For SRP-D-ResNet, SRP acts on both the residual and identity branchs. For D-ResNet, SRP is not used.
It can be seen that in the residual branch, the feature map of SRP-O-ResNet and SRP-D-ResNet contains more and wider responses than D-ResNet (double branch attention of ResNet-50). In the identity branch, the feature map of SRP-D-ResNet contains more and wider responses than both SRP-O-ResNet and D-ResNet. These facts indicate that due to the effect of SRP, the feature maps from corresponding branch will have more and wider object responses.

\noindent\textbf{SRP on fine-grained Recognition.} In order to investigate the reason why SRP is more effective in fine-grained classification tasks, we use Grad-CAM to compare the visualization results of network train with or without SRP in CUB-200-2011. As we can see in Figure \ref{fig:6}, SRP can promote the network to focus on more details of the bird, such as the tip of the wing, the tail or the claw, while the network without SRP mostly tends to focus on one region. This indicates that SRP can promote the network to learn more detailed features of object, which becomes the key to the success of SRP in fine-grained classification tasks. It can be also observed that the network will pay attention to some unimportant fragment regions when $\lambda$ of SRP is too small. We conjecture that a too small $\lambda$ will cause SRP to obtain the over-fragmented information about the feature map, which may affect the performance of the attention mechanism.

\section{Conclusion}

In this paper, we propose a new method called Stochastic Region Pooling(SRP) for channel-wise attention networks. SRP stochastically selects the region from the feature map to extract descriptor in the training stage, promoting convolutional layer have more important feature responses, and making the network to focus on more and wider spatially distributed regions. Besides, SRP is the general method that can be applied to attention network without modifying the network structure and increasing any additional parameters. Our experiments show that the channel-wise attention network trained with SRP can achieve significant performance improvements on various image classification tasks and challenge the state-of-the-art methods. It is also proved that gradually decreasing the scale ratio of region as the depth of layer leads to the better accuracy.

{\small
\bibliographystyle{ieee}

redpajama_set_name: RedPajamaArXiv


text:
<?php declare(strict_types=1);

namespace Predicate\Framework;

/**
 * DualP test
 *
 * @see DualP
 * @coversDefaultClass Framework\Framework\DualP
 * @author Krzysztof Piasecki <krzysiekpiasecki@gmail.com>
 * @package Framework\Framework
 * @since 1.0
 */
class DualPTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers ::__construct
     * @covers ::__invoke()
     */
    public function testInvoke()
    {
        $this->assertTrue((new DualP(new TrueP))(1, 2));
    }

    /**
     * @covers ::__construct
     * @covers ::__invoke()
     * @expectedException \BadMethodCallException
     * @expectedExceptionMessage This is the predicate of two subjects
     */
    public function testInvalidSubjectCount1()
    {
        $this->assertTrue((new DualP(new FalseP))(1));
    }

    /**
     * @covers ::__construct
     * @covers ::__invoke()
     * @expectedException \BadMethodCallException
     * @expectedExceptionMessage This is the predicate of two subjects
     */
    public function testInvalidSubjectCount3()
    {
        $this->assertTrue((new DualP(new FalseP))(1, 2, 3));
    }

    /**
     * @covers ::__construct
     * @covers ::__invoke()
     * @expectedException \BadMethodCallException
     * @expectedExceptionMessage This is the predicate of two subjects
     */
    public function testNoSubject()
    {
        $this->assertTrue((new DualP(new FalseP))());
    }
}

redpajama_set_name: RedPajamaGithub


text:
Q: variables/arrays from tcl procedure How could i pass some variables/ arrays outside of procedure?
Lets say I've my procedure 'myproc' with inputparameters {a b c d e}, e.g.
myproc {a b c d e} {
    ... do something
    (calculate arrays, lists and new variables)
}

Inside this procedure I want to calculate an array phiN(1),phiN(2),...phiN(18) out of the variables a-e which itself is a list, e.g.
set phiN(1) [list 1 2 3 4 5 6 7 8 9];

(lets say the values 1-9 had been calculated out of the input variables a-e). And I want to calculate some other parameter alpha and beta
set alpha [expr a+b];
set beta  [expr c+d];

Anyway no I want to pass these new calculated variables outside of my procedure. Compare to matlab I simply would write sg like to get these variables outside of the 'function'.
[phiN,alpha,beta] = myproc{a b c d e}

Has anybody an idea how I can deal in tcl?? Thanks!

A: There are several options:

*

*Return a list and use lassign outside
Example:
proc myproc {a b c d e} {
    set alpha [expr {$a+$b}]
    set beta [expr {$c+$d}]
    return [list $alpha $beta]
}

lassign [myproc 1 2 3 4 5] alpha beta

This is fine if you return values, but not arrays.

*Use upvar and provide the name of the array/variable as argument
Example:
proc myproc {phiNVar a b c d e} {
    upvar 1 $phiNVar phiN
    # Now use phiN as local variable
    set phiN(1) [list 1 2 3 4 5 6 7 8 9]
}

# Usage
myproc foo 1 2 3 4 5
foreach i $foo(1) {
     puts $i
}

*Use a combination of both
Example:
proc myproc {phiNVar a b c d e} {
    uplevel 1 $phiNVar phiN
    set alpha [expr {$a+$b}]
    set beta [expr {$c+$d}]
    set phiN(1) [list 1 2 3 4 5 6 7 8 9]
    return [list $alpha $beta]
}

lassign [myproc bar 1 2 3 4 5] alpha beta
foreach i $bar(1) {
     puts $i
}

Edit: As Donal suggested, is is also possible to return a dict:
A dict is a Tcl list where the odd elements are the keys and the even elements are the values. You can convert an array to a dict with array get and convert a dict back to an array with array set. You can also use the dict itself.
Example
     proc myproc {a b c d e} {
        set alpha [expr {$a+$b}]
        set beta [expr {$c+$d}]
        set phiN(1) [list 1 2 3 4 5 6 7 8 9]
        return [list [array get phiN] $alpha $beta]
    }

    lassign [myproc 1 2 3 4 5] phiNDict alpha beta
    array set bar $phiNDict
    foreach i $bar(1) {
         puts $i
    }
    # Use the [dict] command to manipulate the dict directly
    puts [dict get $phiNDict 1]

For more ideas (this is about arrays, but could apply to values as well) see this wiki entry.

redpajama_set_name: RedPajamaStackExchange


I'm feeling a little more clear-headed at the moment — not as fuzzy-brained as before. Well, there's the slight matter of my ongoing cough and congestion, so I'm not quite all the way there, but I can think more easily than I did last week.
Cycling through different mental states (normal, squirrel, fuzzy, etc.) in quick succession has been helping me get better at differentiating among them, and I've been thinking about how I can make the most of them. In particular, I've been thinking about the consequences of considering one or the other as my "default" state, or of getting rid of the notion of a default state altogether.
If I think of clarity as my normal state and fuzziness as a short interruption, then when I'm sharp, it makes sense to make the most of it, and when I'm fuzzy, it makes sense to do the background work that will help me make the most of my next sharp period.
If I think of fuzziness as my normal state and clarity as a gift, then when I'm clear, it makes sense to invest a lot into building the systems, habits, and skills that would make fuzzy times even better. I'm not sure how probable this is, but I'm leaning towards it being likely, even though I tend to remember my past as clear. I'm basing this on the fact that many people around me have reported being relatively slower compared to their younger selves, possibly due to age and circumstances. On the other hand, I know a few people who are older than I am and who seem to be accelerating, so there's something to be said for that.
A mix of both strategies seems to make sense. I can spend some time putting the infrastructure in place to do well during fuzzy times, and I can also take advantage of quick sprints to make things happen when I have a clear idea.
When I'm sharp, that's the time to lean in on health and systems and skills, the time to act on ideas and explore questions, the time to come up with lots of ideas and define tasks that I can do while fuzzy. It's important to write, too, so that I can remember what it's like to be sharp.
When I'm fuzzy and don't feel particularly like pushing, that's a good time to focus on self-care and close relationships. It's okay to relax, to observe, to explore.
And there's always the philosophical practice at being patient and dealing with challenges… It's good.
Hmm. What's a good way for me to tell whether I'm under-preparing, over-preparing, or getting the balance right?
If I under-prepare for fuzziness while I'm sharp, then when I'm fuzzy, I'm stuck with low-value activities like video games. This is okay, but with some thought, I might be able to tweak it to get more value.
If I over-prepare for fuzziness while I'm sharp, then I'm missing the opportunity to build momentum and get stuff done.
If I under-prepare for sharpness while I'm fuzzy, then when I'm sharp, I end up spinning my wheels or doing things that I could have done when I was fuzzy anyway.
If I over-prepare for sharpness while I'm fuzzy, I might prolong my fuzziness or feel bleah.
Hmm. It might be interesting to revisit my notes on the kinds of things I can do when I'm sharp and when I'm fuzzy (High energy and low energy activities). That might help me detect if I'm using my sharp time well.
Also, it's okay not to totally optimize this. =) I can be a little inefficient.
You know how when you get going on something, you want to keep going? It's a great feeling. You're in the flow, you're in the zone. Time passes unnoticed. You're getting stuff done.
I don't trust that feeling. At least not all the way.
Here's what got me thinking about this: I had just finished sketchnoting a book. It was fun. I felt accomplished. I wanted to do another sketchnote. In fact, I had already returned the previous book, picked another book from the shelf, and settled in for more drawing.
Then I stopped and asked myself, Is this really what I should be doing next? I was basking in the glow of people's appreciation on Twitter and I already had all my tools set up for doing the next book, so it made sense to do another sketchnote. But was that really the best use of that moment?
More of the same, or something else?
I still stay up too late programming sometimes. I still spend hours reading. I still write my way past lunch, snapping out of the trance, suddenly starving, late in the afternoon. But I'm getting better at paying attention when part of me pipes up with weird questions.
Am I at the point of diminishing returns or temporary saturation? It's like the way that if you're eating your favourite food, there's a point after which you don't enjoy it as much. Sometimes giving it a bit of a rest lets you appreciate it more.
What could I be neglecting if I focus on this, both in terms of things I need to do and things I want to do? Am I better off spending time with W-, taking care of things around the house, or learning about things that don't currently give me the same thrill?
Is there value in letting this simmer and blend? I can crank out a lot of similar things quickly. Or I can give myself time to learn from people's feedback and my reflections on process, so that I improve more with each step. Sometimes different things mixed together result in interesting flavours and textures, like the difference between a purée and a stew.
It's easy to do more, but what would enable me to do better? How can I step back and improve the infrastructure for future work? Infrastructure is not exciting, but it's good to do. It helps to think about specific ways to make something better. What could better mean?
With better chunking or flow?
Sure, sometimes I'll lose myself coding or writing or drawing. But sometimes it's good to interrupt my momentum and ask: What's important to do, even if it's not currently as shiny or as fun as what I'm doing?
Do you do this too? What have you learned? What questions do you ask yourself to help you decide what to do next?


text:
Алекса́ндр Ма́рков:

 Марков, Александр Альбертович (род. 1963) — американский скрипач.

 Марков, Александр Иванович (1781—1844) — русский генерал-майор.
 Марков, Александр Маркович (1916—1953) — советский лётчик, Герой Советского Союза.
 Марков, Александр Михайлович (1901—1982) — советский медик. Доктор медицинских наук, профессор. Начальник 4-го Главного управления Министерства здравоохранения СССР (1951-1966). Заслуженный деятель науки РСФСР (1959).

 Марков, Александр Трофимович (1877—1935) — Председатель ЦК Союза текстильщиков, кандидат в члены ЦК РКП(б)-ВКП(б).

redpajama_set_name: RedPajamaWikipedia


text:
Winmail Opener
appreviewed.net / Free Software / Communications
Datei Größe: 353KB
Entwickler: Eolsoft
Winmail Opener could be useful for anyone who sends or receives e-mail in one of the older versions of Microsoft Outlook such as 97 or 2000 (winmail.dat). This utility allows users to view and extract the contents from messages from these sources. The rich-text message contents and attachments from these Outlook applications are not supported by several e-mail clients that are used today and Winmail Opener is a freeware solution to this problem.
Winmail has a traditional Windows look and feel to it with drop-down menus. It also has full Windows drag-and-drop capabilities so it is easy to move text and attachments from an e-mail to a document or other location. Text is displayed in a center window with a scroll bar with attachments in a sidebar window. This freeware application supports users in 13 languages and is small in size, so it uses little memory or disk space.
This application downloads quickly, and runs stably without affecting PC performance. Winmail Opener works well and costs nothing, and can help solve a big compatibility problem.
From Eolsoft: Winmail Opener is a small and simple utility that allows you to view and extract contents of TNEF-encoded files (infamous winmail.dat). Winmail Opener can decode and show RTF message text and all embedded attachments, has full drag-and-drop support and supports command line mode for batch decoding.

redpajama_set_name: RedPajamaCommonCrawl


text:
Image Courtesy Kingsley Napley LLP
English Court of Appeal follows US case example in deciding earning capacity is not a matrimonial asset to be shared
Jane Keir of Kingsley Napley LLP reports on how the case will affect American seeking divorce in the UK
www.kingsleynapley.co.uk
London is often seen as "Divorce capital of the world" by wealthy expats, usually the wives, wanting a generous divorce settlement, but this latest UK case shows there are limits.
The English Court of Appeal issued an emphatic "No" in April 2018 to an attempt by a wife to argue that her husband's earning capacity is capable of being a matrimonial asset, to which the sharing principle applies and in the product of which, as a result, she had a continuing entitlement to share.
The case (Waggott v Waggott [2018] EWCA Civ 727) involved Karen Waggott, ex-wife of successful businessman William Waggott, FD of TUI Travel, attempting to increase her annual maintenance payment. Mrs Waggott had received some £8.4m of capital resources in her divorce settlement and her former husband some £7.8m, after a contested final hearing. She received an additional £1.4m comprising deferred remuneration earned by the husband so that her total settlement came to £9.76m. She was also awarded continuing maintenance to bridge the shortfall between her assumed net income (£60,000) and her annual income needs at £175,000. Both parties appealed.
The main plank of the wife's argument on appeal was that an earning capacity is "an asset referable to or the product of marital endeavour and should, therefore, be divided between the parties by application of the sharing principle as with other marital assets". It was argued that a different outcome would not be fair due to its discriminatory nature.
The idea that an earning capacity is capable of being a matrimonial asset is not, however, a new one. Often on an appeal of this sort and at this level, legal representatives will look at the state and development of the law in other countries and jurisdictions and the United States is a particularly rich source with its 50 different states all with their own laws, precedents and court systems. Take the State of New York for example. In 1985 the case of O'Brien came up for adjudication. Mr and Mrs O'Brien married in the US and then moved to Mexico so that the husband could go to medical school and get his licence to practice as a doctor. They then moved back to the US so he could finish his medical training and get his licence. Some two months after he did so and filed for a divorce. New York's highest court held that his medical degree could be divided if the wife could show she contributed to the process of obtaining it. The case of O'Brien remained good law in New York for some 30 years until 2015 when the New York Legislature effectively reversed it, stating that the court should not consider the value of a spouse's enhanced earning capacity (e.g. arising from the licence, degree, celebrity goodwill or career enhancement) as marital property subject to distribution.
Life is rarely, in fact, quite so simple and in the vast majority of cases, the earning capacity of one or both spouses is available and divisible because it generates the income in a marriage upon which any children are likely to depend, if not in addition, the non-earning spouse for probably many years ahead. Not only did Mrs Waggott fail to persuade the Court of Appeal that her husband's earning capacity was capable of being a matrimonial asset and therefore, available for division, but the Court then allowed his appeal on the basis that the trial judge had failed to give sufficient weight to the clean break principle and it went on to order that what had previously been a joint lives order (providing for the wife to receive £175,000 p.a.) should be terminated on 21 March 2021.
So nice try by Mrs Waggott but no doubt about it, the Court of Appeal Judgment was emphatic in its rejection of any attempt to prolong a financial connection between the parties and that a full, clean break of both parties' financial claims remains the ultimate objective on divorce.
The author is Jane Keir, Partner in Family and Divorce law at London based law firm Kingsley Napley LLP.
E: jkeir@kingsleynapley.co.uk
>> MORE EXPAT ADVICE


text:
Houston Sports Images
Refs Gone Wild
The accountability of a Referee
It's well known to any soccer aficionado that the central referee has all the power.
They make the calls, or choose not to make calls
They issue disciplinary action
They decide whether or not to accept their assistant referees' calls.
It is not an easy job, there's no disputing that. They have to be in excellent physical condition running the whole of the pitch for 90 plus and it's a thankless job to say the least when they get it right.
But what about when they get it wrong?
At a recent game I attended I witnessed some very bad calls and it got me thinking, are the refs being held accountable and to what extent?
The Houston Dynamo faced FC Dallas Saturday, April 5 at BBVA Compass Stadium, a rivalry as big as the state of Texas. Ask any Dynamo fan and they'll happily give you the low down on the big D. A long standing rivalry, they play for pride and a cannon named El Capitan. The Dynamo at one point even commissioning a billboard sign just inside Dallas city limits with a picture of the MLS cup with the phrase: Houston, 2 times better than Dallas.
The 1st official or main referee was Ricardo Salazar a referee known for causing controversy on a good day and downright altering the outcome of games in other instances. During the August U.S. Open cup final where Sporting Kansas City faced The Seattle Sounders, he handed out 6 yellow cards and one red card to Seattle and didn't issue a single card to KC for what were widely viewed as similar and possibly worse fouls committed by Sporting KC. There is even an imitation twitter page that was started called @RedCardoSalazar to parody Referee Salazar for his love of wrongful Red Cards.
The game had just begun and the opposing team had control of the ball. After a great pass to the opposing forward, who was preparing to take a shot, a defender made an amazing sliding tackle winning the ball in the opposing box that brought me and the rest of the crowd to our feet. He managed to pass the ball to the on rushing midfielder while still on the ground who crossed the ball to a waiting forward. After beating the keeper who came out too early, the only thing standing between him and the goal was a single defender. The opposing defender came to challenge him and after having the ball skillfully touched past him, the defender with few options, horse collared the forward taking him to the ground.
During what would normally be considered a last man foul that by the letter of the law results in an immediate red card dismissal, the defender kicked the forward in the head while he was still on the ground. It wasn't clear whether or not the kick was intentional but intent aside blood was spilled and the training staff had to enter the field to attend to the injured player.
As the medical staff addressed the bloody and disheveled forward, the crowd including myself waited for disciplinary decision from the ref. He didn't bother consulting his assistant as both teams were crowded around him, no doubt pleading their cases.
Welcome to the 2018 Season
This Just In: Penso, the league made me do it
Tyler Deric, what the Domestic is going on…
Gold Cup 2017: the mess created by French Guiana
This Just In; Referee reveals Bribes For Boats
My Dime


This TxBux ticket internet reservation service allows customers to purchase the intercity bus tickets they need through the web browsers on their computers without the need to visit a terminal.
When making internet reservations, customers may view information on terminals providing internet reservation services (return/one-way), free reservation (no seat designation) and bus service information.
Internet reservation services allow for various types of payment Use of some check cards or corporate credits cards may be restricted when making payments for ticket reservations.
You may not be issued the ticket for your reservation after your bus has left.


text:
The 10 best exercises for women, according to a trainer
Angela Gargano
What are the best exercises for women?
One of the biggest mistakes I see people make when starting to work out (or jumping back into exercise after taking a break), is that they want to go right into the 2.0 level stuff they see people doing on Instagram or at the gym. They think that if it doesn't look like it'll kill you, how can it make you stronger? The truth is, though, that you need to learn how to plank before you burpee; otherwise you can hurt yourself or cause imbalances in your body.
Start, instead, by building a solid foundation, and for my female clients, that means focusing on their hip area and core, which includes your abs and back. These muscle groups combine to form the powerhouse of the female body, so any strength-building workout for women should target them both.
Focusing on the basics does NOT, however, mean you aren't going to get in a stellar workout. Some of the best exercises for women are foundational movements that will sculpt, strengthen, and challenge your total body big time.
So, if you're looking for a workout plan for women that is good for all levels and will help you tone up from head to toe, try doing the 10 moves below as a circuit. The majority of the drills are bodyweight exercises, but you will need a set of dumbbells for the renegade rows — and the leg lifts if you want even more of an abs challenge.
Master these exercises and you'll be ready for power cleans and Turkish get-ups in no time!
Equipment: dumbbells
Best for: total-body strength
Instructions: Do all sets/reps for each move before continuing to the next exercise. These are some of the best exercises for women, and as such, I'd recommend performing this total-body workout two to three times per week. If you're looking for a longer workout, you can start the sequence over again from the top once you finish and repeat it one to two more times. Just make sure to rest for two to three minutes in between circuits.
Dead Bug
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/deadbug-2-1562621376.mp4
How to: Start lying back with arms extended over chest, legs raised and bent at 90 degrees (knees above hips and shins parallel to floor). Keep low back pressed to the floor, brace core, then slowly and simultaneously extend and lower right leg and to hover just above mat. Pause, then return to start and repeat on the opposite side. That's one rep. Complete as many reps as possible, with control, in 30 seconds.
Leg Drops
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/leg-drop-dumbbell-1570054423.mp4
How to: Start lying on back with a dumbbell lifted over chest, arms straight, and legs raised toward ceiling, knees and ankles stacked over hips. Lower left leg down as low as you can go without lower back arching up off the mat. Return to start, and repeat on the other side. That's one rep. Complete as many reps as possible, with control, in 30 seconds.
The weight here is optional. Feel free to ditch it and place hands, palms down, under butt for added support.
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/2019-womenshealth-fitnessloops-ep11-betina-kw-cg-v02-graded-sub-02-1080x1080-1567703011.mp4
How to: Start kneeling at back of mat with toes tucked and butt resting on heels. Walk hands forward to an all fours position with knees under hips and wrists under shoulders. Lift knees to form one straight line from heels to head. Keep hips high and abs engaged. Hold for 30 seconds then return to start.
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/clamshell-1548194701.mp4
How to: Start lying on left side with left arm bent, head supported by hand, right hand on hip, right leg on top of left, knees bent and heels in line with glutes. Open legs like a book by lifting right knee toward ceiling without allowing right hip to roll backward. Return to start. That's one rep. Complete as many reps as possible, with control, in 30 seconds, then switch sides.
This exercise will also help activate the smaller muscle groups in your legs so that you can truly target the bigger muscle groups when doing more advanced strength exercises.
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/glute-bridge-1557242659.mp4
How to: Start lying on back with legs bent, feet flat on floor, and arms by sides. Engage abs, squeeze glutes, press into heels, and raise hips toward the ceiling until body forms one line from shoulders to knees. Hold the position for two seconds before lowering to start. That's one rep. Complete three sets of 10 reps.
Single-Leg Deadlift
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/single-leg-deadlift-1569358473.mp4
How to: Start standing with feet together and arms by sides. With control, tilt torso forward while lifting left leg behind body (foot flexed) and extending left arm forward until both are parallel with floor. Return to start. That's one rep. Complete three sets of 10 reps per side.
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/superman-loop-wh-1568820474.mp4
How to: Start lying on stomach with arms and legs extended on the floor so body forms one long line, forehead on mat. Engage abs, squeeze glutes and lift all four limbs, plus chest and head a few centimetres off the ground, keeping your neck neutral by gazing at top of mat. Hold for 3–5 seconds then slowly lower back to the starting position. That's one rep. Complete as many reps as possible in 30 seconds.
Reverse lunge
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/reverse-lunge-1572635093.mp4
How to: Start standing with feet hip-width apart, arms by sides. With control, step left foot back and lower down until both legs form 90-degree angles and back knee is hovering 5–7 centimetres off the ground. Reverse the movement to return to start. That's one rep. Complete three sets of 10 reps per side without alternating.
Military press
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/military-press-1557173318.mp4
How to: Start standing with feet shoulder-width apart, hands extended straight overhead, palms facing forward, with biceps by ears. (Note: You can use dumbbells for an added challenge.) Keeping back straight and core engaged, slowly lower arms by sides until elbows are bent at 90 degrees. Be sure to squeeze shoulder blades together at the bottom of this movement. Return to starting position. That's one rep. Complete three sets of 10 reps.
Renegade row
https://www.womenshealthsa.co.za/wp-content/uploads/2020/01/renegade-row-1557242801.mp4
How to: Start in a plank position holding a dumbbell in each hand, wrists straight, feet slightly wider than hip-width apart. While keeping hips and shoulders level, bend left arm and pull elbow back directly behind you. Stop when weight reaches chest height. Lower the dumbbell to the floor, then repeat the move by rowing the right dumbbell. That's one rep. Complete three sets of 10 reps.
This article was originally published on www.womenshealthsa.co.za
How to lose fat and gain muscle at the same time, according to experts
8 Trainer tips to get abs and keep them
This is how international actress, Kim Engelbrecht keeps her body in shape
How to survive a run when it's seriously hot outside


text:
Home Sport 'I'm only human': Hamilton explains Russia reaction
'I'm only human': Hamilton explains Russia reaction
"I may not always react the way you want me to when tensions are high, but I am only human after all," says Hamilton on social media
By Matt Morlidge
Last Updated: 29/09/20 3:07pm
Lewis Hamilton has admitted he "may not always get it right" following his critical comments at the Russian GP, but says he is "only human" and has vowed to learn from a frustrating weekend.
After receiving two separate 5s penalties for pre-race practice start infractions in Sunday's race, Hamilton, who finished third, called the ruling "ridiculous" and told Sky F1 stewards are "trying to stop" him.
While Hamilton rowed back shortly after in Sochi and said he did not feel targeted, he again stated his belief the regulations were being changed to aid other drivers and teams and "keep racing exciting".
In his first social media post since Sunday, Hamilton reflected:
"I may not always get it right in the face of adversity. I may not always react the way you want me to when tensions are high, but I am only human after all and I am passionate about what I do.
"I'm learning and growing every day, and I'll take my lessons and keep fighting on to the next one. Thank you to those who continue to support and are right there fighting with me. Still we rise!"
pic.twitter.com/H0dmbGQnHG
— Lewis Hamilton (@LewisHamilton) September 29, 2020
Mercedes, whose radio instructions played a big part in Hamilton picking up penalties, backed the Englishman after the race, with team boss Toto Wolff insisting he is treated "harshly".
Asked about Hamilton's 'trying to stop me' comments, Wolff explained: "I think Lewis has faced a lot of adversity in his life and for all of us, the penalty seems a little harsh. Never before has a pre-race or reconnaissance lap infringement been penalised with an in-race penalty. That's new.
Lewis Hamilton claimed the authorities were trying to stop him from winning the Russian Grand Prix after he was given two five-second penalties in Sochi
"Things go against him harshly sometimes. I guess if you're the most successful driver, you have to take that."
FIA race director Michael Masi, meanwhile, insisted Hamilton was penalised in line with the regulations and was not singled out.
Two five-second penalties for pre-race practice start transgressions wreck Lewis Hamilton's bid to equal Michael Schumacher's wins record
"We have the stewards as an independent judiciary to adjudicate those, and therefore there was an infringement and it doesn't matter if it was Lewis Hamilton or any one of the other 19 drivers, if a breach has occurred of the regulations they will consider it on its merits," the FIA race director was quoted as saying by F1.
"And also further to that I would say adjudicate it equitably and fairly in the circumstances, taking all of the key elements into account."
Previous articleBroady: Coach Sammel my inspiration
Next articleDean Jones – a statistical appreciation
Machine Gun Kelly designed Megan Fox's engagement ring to hurt coming...
How 'The Amazing Race' handled its return on screen after covid...


text:
Hokies Land First Recruit Of 2013 Class In Trevor Thompson
By chicagomaroon Sep 5, 2012, 12:26pm EDT
Share All sharing options for: Hokies Land First Recruit Of 2013 Class In Trevor Thompson
Presswire
The Virginia Tech basketball program finally got some news of the good variety yesterday, when 6'9"/6'10" center Trevor Thompson out of St. Johns Northwestern Military Academy in Delaplane, Wi. Thompson, listed as a 3-star recruit by both Rivals and 247 Sports, completed his high school eligibility a year ago at Ben Davis High School in Indianapolis, In., but is prepping at St Johns.
According to Techhoops.com, Thompson is originally from Reston, Va., and at one point attended South Lakes High School, so there is a local connection of some sort.
247 Sports has only confirmed two offers for Thompson (Virginia Tech and Ball State), while Rivals confirms at least four offers for the big man, whose stock has continued to increase over the summer. He is viewed as quite a raw prospect, but if there is one rule in basketball, it's that there are only so many 6'9"/6'10" guys out there, and one thing you can't coach is size.
Thompson's commitment to the Hokies does several things; 1. It legitimizes James Johnson as a recruiter to recruits and skeptics, and 2. It provides the Hokies with sorely needed post depth (or, just any depth). The Hokies still have only eight scholarship players eligible to play in 2012 on their roster after a mass of defections (relative to basketball) following the firing of longtime coach Seth Greenberg on April 24. Those eight players and two walk ons include only three true post players, one of which who was redshirted a year ago.
Thompson was visiting Monday during the Virginia Tech-Georgia Tech football game. He admitted that once he left he didn't want to wait any longer, so it looks like our fans played a part in Trevor's commitment.
I was unable to find any video on Thompson, but trust me, as soon as I have it, you will have it and I will break it down for you at that point. I was able to find out that Thompson averaged around 10 points and 8 rebounds a year ago for Ben Davis HS. Fans of Chieck Diakite and lovers of defense will be excited to know that Thompson also averaged nearly 4 blocks per game a year ago.
To be honest, those statistics are very underwhelming for a high school player going to play college basketball in a power conference a year from now, but it's a start. He will probably not have an immediate impact for the Hokies unless his game matures in a year, but it might be a blessing in disguise as his basketball immaturity may have allowed him to fly under the radar and allowed the Hokies to land him.
For all things Hokie basketball, including several feature posts leading up to the season, stay tuned to Gobbler Country.


KUALA LUMPUR - The newest formula driver sensation of New Zealand and cousin of a Formula One driver, Fabian Coulthard, dominated in dramatic fashion last Sunday's Asian Formula 2000 Series in the Sepang International Circuit, Malaysia.
Coulthard won rounds five and six, which turned the tables on qualifying hopefuls led by ZED-SAN MIGUEL BEER-MP TURBO Team Philippines Mike Potenciano, who took a spectacular pole position in his last qualifying lap in a wet track for round five. Mike again belted out a great third place in the dry, second qualifying session, even though he had traffic in front of his best lap.
"After a superb qualifying session, we expected to be there on the podium for this event. However, our engine developed a problem and progressively got worse during the day. It was a frustrating day for the whole team," Potenciano said dejectedly after finishing a lowly 7th and 9th in rounds five and six, respectively.
Coulthard, starting from 4th place, romped home unchallenged in the morning race as the rest of the field couldn't match the speed of the leader. AF2000 Series leader Indonesia's Meckel Ali came in second and Singapore's Dennis Lian in third but both gave up chasing the Kiwi and concentrated on their own race. The pace set by Fabian was so grueling that he was nearer his qualifying times in a track that was dry and in ideal conditions.
The toast of the town though was Japanese lady driver and previous Benetton F1 image model, Keiko Ihara. She spun in the first lap of round five, giving chase to the top three, but made amends in the final race by taking 2nd place overall with less than a second away from Coulthard.
"I am disappointed," replied Keiko after the race. "I came here to win but I just couldn't get the result I wanted. I was hoping to get the best results to convince the sponsors back home who didn't have the confidence to invest in a female formula driver. They told me to drive a touring car instead and I want to prove them wrong." Ali finished in third place and stretched his points lead in the series.
Potenciano's problems started after the dominating the final practice session on Friday, when the engine's cam belt spun and bent all of its exhaust valves. A new cylinder head was swapped onto the old block and performed well in qualifying but slowly lost power. Soon the engine wouldn't climb to its 7200 rpm rev limit and in the final race, could only climb to 6400 in the end.
"We thought that the bottom-end of the engine was not damaged. The team changed all auxiliaries before the next race but we weren't able to improve it. We made the wrong decision to just change the head. We'll change the engine and try again in the next race," explained San Pablo City's Mike.
The lone Filipino entry's racing efforts were supported by the world's largest mobile services provider ZED, internationally acclaimed SAN MIGUEL BEER, lubricants specialist GULF OIL, Sonencher Motor Racing Team, BLTBCO and MP TURBO.
"We have at least proven to the AF2000 community that we are capable of getting pole position. We hope our luck will change and we'll be up there for the team and country. Our day will come and we'll never give up," added Potenciano.
Come-backing tandem Jun Diaz and co-driver Armin Amio took the top post on the podium at the recently concluded Round 2 of the Petron Blaze Rallye Series last Saturday.
Want to take on David Coulthard on a Mercedes-Benz SLS?


text:
function ItfzFormAcceso(div, form){
    Interfaz.call(this);

    this.cargarInterfaz(div, form);
}
ItfzFormAcceso.prototype = Object.create(Interfaz.prototype, {
    __super: {
        value: Interfaz.prototype
    },
    UI: {
        value: UI_FORM_ACCESO
    },
    CSS: {
        value: CSS_FORM_ACCESO
    },
    cargarInterfaz: {
        value: function(div, form){
            this.__super.cargarInterfaz.apply(this, [div, function(){
                console.log(form);

                switch (form){
                    case FORM_REG:
                        new ItfzRegistro($("#formRegistro"), true);
                        new ItfzLogin($("#formInicio"), false);
                        new ItfzRecuperarPass($("#formPass"), false);
                        break;
                    case FORM_PASS:
                        new ItfzRecuperarPass($("#formPass"), true);
                        new ItfzLogin($("#formInicio"), false);
                        new ItfzRegistro($("#formRegistro"), false);
                        break;
                    case FORM_LOG:
                    default:
                        new ItfzLogin($("#formInicio"), true);
                        new ItfzRegistro($("#formRegistro"), false);
                        new ItfzRecuperarPass($("#formPass"), false);
                        break;
                }
            }]);
        }
    },
    mostrarMensajeError: {
        value: function(contenedor, mensaje){
            $("
", {
                class: "alert alert-danger alert-dismissable",
                html: mensaje
            }).prepend("×").prependTo(contenedor);
        }
    }
});

function ItfzLogin(div, mostrar){
    Interfaz.call(this)

    this.cargarInterfaz(div, function(){
        this.cargarEventos();

        if (mostrar)
            this.mostrarForm();
    }.bind(this));
}
ItfzLogin.prototype = Object.create(Interfaz.prototype, {
    __super: {
        value: Interfaz.prototype
    },
    UI: {
        value: UI_LOGIN
    },
    CSS: {value: null},
    cargarEventos: {
        value: function () {
            // blur cajas
            $("#txtUsuarioLog").bind("blur", this.blurCajas);
            $("#txtPassLog").bind("blur", this.blurCajas);

            // clicks botones y enlaces
            $("#btnLogin").bind("click", this.validarForm);
            $("#btnMostrarRegistro").bind("click", function(){
                this.ocultarForm();
                ItfzRegistro.prototype.mostrarForm();
            }.bind(this));
            $("#recuperarPass").bind("click", function(){
                this.ocultarForm();
                ItfzRecuperarPass.prototype.mostrarForm();
            }.bind(this));
            $("#btnRecordar").bind("click", function(){
                $("#checkRecordar").prop("checked", !$("#checkRecordar").is(":checked"));
                $("#checkRecordar").triggerHandler("change");
            });
            $("#checkRecordar").bind("change", function(){
                if ($(this).is(":checked")){
                    $("#btnRecordar").removeClass("btn-default").addClass("btn-info");
                    $("#btnRecordar i").removeClass("glyphicon-unchecked").addClass("glyphicon-check");
                } else {
                    $("#btnRecordar").removeClass("btn-info").addClass("btn-default");

                    $("#btnRecordar i").removeClass("glyphicon-check").addClass("glyphicon-unchecked");
                }
            });
        }
    },
    mostrarForm: {
        value: function(){
            $("#formInicio").show(1000);

            $("#titForm").html("Iniciar sesión");
        }
    },
    ocultarForm: {
        value: function(){
            $("#formInicio").hide(1000, function(){
                $("#txtUsuarioLog").val("").parent().removeClass("has-error");
                $("#txtPassLog").val("").parent().removeClass("has-error");

                $("#errorUsuarioLog").html("");
                $("#errorPassLog").html("");

                $("#btnLogin").addClass("disabled");
                $(".alert").remove();
            });
        }
    },
    blurCajas: {
        value: function(){

            if ($(this).val() == ""){
                $(this).parent().addClass("has-error");

                $("#btnLogin").addClass("disabled");
                $("#btnLogin").attr({disabled: true});
            } else {
                if ($("#txtUsuarioLog").val() != "" && $("#txtPassLog").val() != "") {
                    $("#btnLogin").removeClass("disabled");
                    $("#btnLogin").removeAttr("disabled");

                    $("#txtUsuarioLog").parent().removeClass("has-error");
                    $("#txtPassLog").parent().removeClass("has-error");
                } else {
                    if ($("#txtUsuarioLog").val() != ""){
                        $("#txtUsuarioLog").parent().removeClass("has-error");
                    }
                    if ($("#txtPassLog").val() != ""){
                        $("#txtPassLog").parent().removeClass("has-error");
                    }

                    $("#btnLogin").addClass("disabled");
                    $("#btnLogin").attr({disabled: true});
                }
            }
        }
    },
    validarForm: {
        value: function () {
            if ($("#txtUsuarioLog").val() != "" && $("#txtPassLog").val() != "") {
                $("#btnLogin").removeClass("disabled");
                $("#btnLogin").removeAttr("disabled");

                $("#txtUsuarioLog").parent().removeClass("has-error");
                $("#txtPassLog").parent().removeClass("has-error");
                return true;
            } else {
                if ($("#txtUsuarioLog").val() == "")
                    $("#txtUsuarioLog").parent().addClass("has-error");
                if ($("#txtPassLog").val() == "")
                    $("#txtPassLog").parent().addClass("has-error");

                ItfzFormAcceso.prototype.mostrarMensajeError($("#divLogin"), "Son necesarios el usuario y la contraseña");

                $("#btnLogin").addClass("disabled");
                $("#btnLogin").attr({disabled: true});
                return false;
            }
        }
    }
});

function ItfzRegistro(div, mostrar){
    Interfaz.call(this);

    this.cargarInterfaz(div, function(){
        this.cargarEventos();

        if (mostrar)
            this.mostrarForm();
    }.bind(this));
}
ItfzRegistro.prototype = Object.create(Interfaz.prototype, {
    __super: {
        value: Interfaz.prototype
    },
    UI: {
        value: UI_REGISTRO
    },
    CSS: {value: null},
    cargarEventos: {
        value: function(){
            $("#txtNombreReg, #txtUsuarioReg, #txtMailReg, #txtPassReg").popover();

            // blur cajas
            $("#txtUsuarioReg").bind("blur", this.blurCajas);
            $("#txtMailReg").bind("blur", this.blurCajas);
            $("#txtPassReg").bind("blur", this.blurCajas);
            $("#txtPass2Reg").bind("blur", this.blurCajas);
            $("#txtNombreReg").bind("blur", function(){
                $(this).popover("hide");
            });
            $("#checkTerminos").on("change", function(){
                console.log($(this).val());
            })

            // Click
            $("#btnRegistrar").bind("click", this.validarForm);

            // Eventos teclas
            $("#txtNombreReg").bind("keypress", function(evento){
                let ev = evento || window.event;

                let char = String.fromCharCode(ev.keyCode || ev.charCode);
                let regEx = /[a-z]|[A-Z]|[á-ú]|[Á-Ú]|[à-ù]|[À-Ù]|[ä-ü]|[Ä-Ü]|\s/;

                if (!regEx.test(char)){
                    $(this).attr({"data-content": char + " no es un caracter válido"});
                    $(this).popover("show");
                    ev.preventDefault();
                } else
                    $(this).popover("hide");
            });
            $("#txtUsuarioReg").bind("keypress", function(evento){
                let ev = evento || window.event;

                let char = String.fromCharCode(ev.keyCode || ev.charCode);
                let regEx = /{|}|[|]|\(|\)|"|'/;

                if (!regEx.test(char))
                    $(this).popover("hide");
                else {
                    $(this).attr({"data-content": char + " no es un caracter válido"});
                    $(this).popover("show");
                    ev.preventDefault();
                }
            });
            $("#txtMailReg").bind("keypress", function(evento){
                let ev = evento || window.event;

                let char = String.fromCharCode(ev.keyCode || ev.charCode);
                let regEx = /\w|@|\.|-|_/;

                if (!regEx.test(char)){
                    if (/\s/.test(char)){
                        $(this).attr({"data-content": "No se admiten espacios en este campo"});
                    } else
                        $(this).attr({"data-content": char+" no es un carácter válido"});

                    $(this).popover("show");
                    ev.preventDefault();
                } else
                    $(this).popover("hide");
            });
            $("#txtPassReg").bind("keypress", function(evento){
                let ev = evento || window.event;

                let char = String.fromCharCode(ev.keyCode || ev.charCode);
                let regEx = /\w|\-|\.|@/;

                if (!regEx.test((char))){
                    if (/\s/.test(char)){
                        $(this).attr({"data-content": "No se admiten espacios en este campo"});
                    } else
                        $(this).attr({"data-content": char+" no es un carácter válido."});

                    $(this).popover("show");
                    ev.preventDefault();
                } else
                    $(this).popover("hide");
            });
            $("#txtPassReg").bind("keyup", function(){
                if ($(this).val().length < 8)
                    $("#infoPassReg").html("Contraseña muy corta").removeClass().addClass("text-danger");
                else {
                    $(this).parent().removeClass("has-error");
                    $("#infoPassReg").html("Seguridad de la contraseña: ").removeClass();

                    let aciertos = 0;

                    if (/\d/.test($(this).val()) && /[a-zA-Z]/.test($(this).val()))
                        aciertos++;
                    if (/[A-Z]/.test($(this).val()) && /[a-z]/.test($(this).val()))
                        aciertos++;
                    if (/\./.test($(this).val()) || /-/.test($(this).val()) || /_/.test($(this).val()) || /@/.test($(this).val()))
                        aciertos++;

                    switch (aciertos){
                        case 0:
                            if ($(this).val().length >= 12)
                                $("#infoPassReg").append($("", {
                                    class: "text-danger",
                                    html: "Baja"
                                }));
                            else
                                $("#infoPassReg").append($("Muy Baja", {
                                    class: "text-danger",
                                    html: "Muy baja"
                                }));
                            break;
                        case 1:
                            if ($(this).val().length >= 12)
                                $("#infoPassReg").append($("", {
                                    class: "text-warning",
                                    html: "Media"
                                }));
                            else
                                $("#infoPassReg").append($("", {
                                    class: "text-danger",
                                    html: "Baja"
                                }));
                            break;
                        case 2:
                            if ($(this).val().length >= 12)
                                $("#infoPassReg").append($("", {
                                    class: "text-success",
                                    html: "Alta"
                                }));
                            else
                                $("#infoPassReg").append($("", {
                                    class: "text-warning",
                                    html: "Alta"
                                }));
                            break;
                        case 3:
                            if ($(this).val().length >= 12)
                                $("#infoPassReg").append($("", {
                                    class: "text-success",
                                    html: "Muy alta"
                                }));
                            else
                                $("#infoPassReg").append($("", {
                                    class: "text-warning",
                                    html: "Alta"
                                }));
                            break;
                    }
                }
            });
            $("#txtPass2Reg").bind("keyup", function(){
                if ($(this).val() == $("txtPassReg").val()){
                    $(this).parent().addClass("has-success");
                    if (ItfzRegistro.prototype.validarForm()){
                        $("#btnRegistrar").removeClass("disabled");
                        $("#btnRegistrar").removeAttr("disabled");
                    } else{
                        $("#btnRegistrar").addClass("disabled");
                        $("#btnRegistrar").attr({disabled: true});
                    }
                }
            });

            $("#btnMostrarLogin").bind("click", function(){
                this.ocultarForm();
                ItfzLogin.prototype.mostrarForm();
            }.bind(this));
            $("#checkTerminos").bind("change", function () {
                if ($("#checkTerminos").is(":checked")){
                    if (ItfzRegistro.prototype.validarForm){
                        $("#btnRegistrar").removeClass("disabled");
                        $("#btnRegistrar").removeAttr("disabled");
                    }
                } else {
                    $("#btnRegistrar").addClass("disabled");
                    $("#btnRegistrar").attr({disabled: true});
                }
            });
        }
    },
    blurCajas: {
        value: function() {
            $(this).popover("hide");

            let cajaOk = true;

            switch (this){
                case document.getElementById("txtUsuarioReg"):
                    if ($(this).val() == ""){
                        $("#errorUsuarioReg").html("Dato obligatorio");

                        cajaOk = false;
                    } else if ($(this).val().length < 6){
                        $("#errorUsuarioReg").html("Longitud mínima: 6 caracteres");

                        cajaOk = false;
                    } else {
                        $("#errorUsuarioReg").html("");
                    }
                    break;
                case document.getElementById("txtMailReg"):
                    if ($(this).val() == ""){
                        $("#errorMailReg").html("Dato obligatorio");

                        cajaOk = false;
                    } else if (!(/^.+@.+\.\w{2,}$/.test($(this).val()))){
                        $("#errorMailReg").html("Formato incorrecto");

                        cajaOk = false;
                    } else {
                        $("#errorMailReg").html("");
                    }
                    break;
                case document.getElementById("txtPassReg"):
                    if ($(this).val() == ""){
                        $("#infoPassReg").removeClass().addClass("text-danger");
                        $("#infoPassReg").html("Dato obligatorio");

                        cajaOk = false;
                    }else {
                        if ($(this).val() == $("#txtPass2Reg").val()){
                            $("#txtPass2Reg").parent().removeClass("has-error").addClass("has-success");
                        } else {
                            $("#txtPass2Reg").parent().removeClass("has-success").addClass("has-error");
                        }

                        if ($(this).val().length < 8) {
                            $("#infoPassReg").removeClass().addClass("text-danger");
                            $("#infoPassReg").html("Longitud mínima: 8 caracteres");

                            cajaOk = false;
                        }
                    }
                    break;
                case document.getElementById("txtPass2Reg"):
                    if ($(this).val() != $("#txtPassReg").val())
                        cajaOk = false;
                    break;
            }

            if (cajaOk){
                $(this).parent().removeClass("has-error").addClass("has-success");

                if (ItfzRegistro.prototype.validarForm()){
                    $("#btnRegistrar").removeClass("disabled");
                    $("#btnRegistrar").removeAttr("disabled");
                } else {
                    $("#btnRegistrar").addClass("disabled");
                    $("#btnRegistrar").attr({disabled: true});
                }
            } else{
                $(this).parent().removeClass("has-success").addClass("has-error");

                $("#btnRegistrar").addClass("disabled");
                $("#btnRegistrar").attr({disabled: true});
            }
        }
    },
    mostrarForm: {
        value: function(){
            $("#formRegistro").show(1000);
            $("#titForm").html("Registro");
        }
    },
    ocultarForm: {
        value: function(){
            $("#formRegistro").hide(1000, function(){
                $("#formRegistro input:text").val("").parent().removeClass("has-error has-success");
                $("#formRegistro input:password").val("").parent().removeClass("has-error has-success");
                $("#checkTerminos").prop("checked", false);

                $("#divRegistro .form-group label").html("");

                $("#btnRegistrar").addClass("disabled");
                $("#btnRegistrar").attr({attr: true});
            });
        }
    },
    validarForm: {
        value: function(){
            let usuValido = $("#txtUsuarioReg").val().length >= 6;
            let mailValido = /^[\w|\.|\:|\-|&|#]+@.+\.[a-z]{2,}$/.test($("#txtMailReg").val());
            let passValida = $("#txtPassReg").val().length >= 8 && $("#txtPassReg").val() == $("#txtPass2Reg").val();

            return usuValido && mailValido && passValida && $("#checkTerminos").is(":checked");
        }
    }
});

function ItfzRecuperarPass(div, mostrar){
    Interfaz.call(this);

    this.cargarInterfaz(div, function(){
        this.cargarEventos();

        if (mostrar)
            this.mostrarForm();
    }.bind(this));
}
ItfzRecuperarPass.prototype = Object.create(Interfaz.prototype, {
    __super: {
        value: Interfaz.prototype
    },
    UI: {
        value: UI_FORM_PASS
    },
    CSS: {value: null},
    cargarEventos: {
        value: function(){
            // Eventos teclado
            $("#txtMail").bind("keypress", function(evento){
                let ev = evento || window.event;

                let char = String.fromCharCode(ev.keyCode || ev.charCode);
                let regEx = /\w|@|\.|-|_/;

                if (!regEx.test(char)){
                    $(this).attr({"data-content": char+" no es un carácter válido"});
                    $(this).popover("show");
                    ev.preventDefault();
                } else
                    $(this).popover("hide");
            });
            $("#txtMail").bind("keyup", function () {
                let regEx = /^.+@.+\.[a-z]{2,}$/;

                if (regEx.test($(this).val())){
                    $("#btnRecuperarPass").removeClass("disabled");
                    $("#btnRecuperarPass").removeAttr("disabled");
                }
                else{
                    $("#btnRecuperarPass").addClass("disabled");
                    $("#btnRecuperarPass").attr({disabled: true});
                }
            });

            // Eventos Click
            $("#btnRecuperarPass").bind("click", this.validarForm.bind(this));
            $("#btnAtras").bind("click", function(){
                this.ocultarForm();
                ItfzLogin.prototype.mostrarForm();
            }.bind(this));

            // Eventos blur
            $("#txtMail").bind("blur", function(){
                $(this).popover("hide");
            });

        }
    },
    mostrarForm: {
        value: function() {
            $("#titForm").html("Recuperar contraseña");

            $("#formPass").show(1000)
        }
    },
    ocultarForm: {
        value: function(){
            $("#formPass").hide(1000, function () {
                $("#txtMail").val("").parent().removeClass("has-error");

                $("#errorMail").html("");
                $(".alert").remove();
                $("#btnRecuperarPass").addClass("disabled");
            });
        }
    },
    validarForm: {
        value: function(){
            $("#formPass .alert").remove();

            if ($("#txtMail").val() == "") {
                this.mostrarMensajeError($("#formPass"), "Debes introducir tu correo");
                $("#txtMail").parent().addClass("has-error");
                $("#btnRecuperarPass").addClass("disabled");
            }
            else{
                let regEx = /^.+@.+\.\w{2,}$/g;

                if (regEx.test($("#txtMail").val())){
                    $("#txtMail").parent().removeClass("has-error");
                    /*
                     *   Se comprueba en el servidor que dicho correo este registrado,
                     *   Si existe generará una nueva clave y enviará un correo electrónico
                     *   al usuario con ella
                     */
                } else
                    this.mostrarMensajeError($("#formPass"), "El email introducido no tiene el formato correcto");
            }
        }
    }
})