Skip to content

Commit a4d71e7

Browse files
committed
fix docs
1 parent b0d6ae4 commit a4d71e7

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

docs/source/encoding.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ Functions
4646
:members:
4747

4848

49+
:hidden:`assign`
50+
~~~~~~~~~~~~~~~~~~~
51+
52+
.. autofunction:: assign

docs/source/notes/compile.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ Install PyTorch-Encoding
2020

2121
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
2222

23+
- Reference:
24+
Hang Zhang, Jia Xue, and Kristin Dana. "Deep TEN: Texture Encoding Network." *The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2017*::
25+
26+
@InProceedings{Zhang_2017_CVPR,
27+
author = {Zhang, Hang and Xue, Jia and Dana, Kristin},
28+
title = {Deep TEN: Texture Encoding Network},
29+
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
30+
month = {July},
31+
year = {2017}
32+
}

encoding/functions/aggregate.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ def backward(self, gradL):
239239

240240

241241
def assign(R, S):
242+
r"""
243+
Calculate assignment weights for given residuals (:math:`R`) and scale (:math:`S`)
244+
245+
.. math::
246+
a_{ik} = \frac{exp(-s_k\|x_{i}-c_k\|^2)}{\sum_{j=1}^K exp(-s_j\|x_{i}-c_j\|^2)}
247+
248+
Shape:
249+
- Input: :math:`R\in\mathcal{R}^{B\times N\times K\times D}` :math:`S\in \mathcal{R}^K` (where :math:`B` is batch, :math:`N` is total number of features, :math:`K` is number is codewords, :math:`D` is feature dimensions.)
250+
- Output :math:`A\in\mathcal{R}^{B\times N\times K}`
251+
252+
"""
242253
L = square_squeeze()(R)
243254
K = S.size(0)
244255
SL = L * S.view(1,1,K)

encoding/modules/encoding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Encoding(nn.Module):
2323
2424
.. math::
2525
26-
a_{ik} = \frac{exp(-\beta\|x_{i}-c_k\|^2)}{\sum_{j=1}^K exp(-\beta\|x_{i}-c_j\|^2)}
26+
e_{ik} = \frac{exp(-s_k\|x_{i}-c_k\|^2)}{\sum_{j=1}^K exp(-s_j\|x_{i}-c_j\|^2)} (x_i - c_k)
2727
2828
Args:
2929
D: dimention of the features or feature channels
@@ -95,7 +95,7 @@ class Aggregate(nn.Module):
9595
Aggregate operation, aggregate the residuals (:math:`R`) with assignment weights (:math:`A`).
9696
9797
.. math::
98-
e_{k} = \sum_{i=1}^{N} a_{ik} (r_{ik})
98+
e_{k} = \sum_{i=1}^{N} a_{ik} r_{ik}
9999
100100
Shape:
101101
- Input: :math:`A\in\mathcal{R}^{B\times N\times K}` :math:`R\in\mathcal{R}^{B\times N\times K\times D}` (where :math:`B` is batch, :math:`N` is total number of features, :math:`K` is number is codewords, :math:`D` is feature dimensions.)

0 commit comments

Comments
 (0)