Meaning of data_train

154 views
Skip to first unread message

Dzung Nguyen

unread,
Dec 8, 2014, 8:14:17 PM12/8/14
to pyst...@googlegroups.com
In the image_segmentation example, data_train is preprocessed and includes the potentials needed for training and validation using textonboost.

What is the  specific meaning of data_train['X'][0], data_train['X'][1] and data_train['X'][2]? I got that data_train['Y'] is the label of each superpixel, and data_train['superpixels'] is the superpixel matrix of the image.

Ben Irv

unread,
Dec 9, 2014, 6:40:41 AM12/9/14
to pyst...@googlegroups.com
Hi,

My understanding of the data is as follows. Going through the levels.

data_train contains all the training data and labels.

data_train['X'] and data_train[Y] contain all the features and labels, respectively, for all the training images

data_train['X'][0] are the node and edge features for each superpixel of image 0. These features correspond to the superpixel label list in data_train['Y'][0] i.e. 92 superpixels.

data_train['X'][0][0] contains 21 features for each of the 92 superpixels (for image 0)
data_train['X'][0][1] contains the pairwise edges between superpixels (for image 0)
data_train['X'][0][2] contains 3 edge features for each edge (for image 0)

data_train['X'][1], data_train['X'][2], data_train['X'][3].... correspond to training image 1, 2, 3 etc.

Hope this helps.

Ben

Ben Irv

unread,
Dec 9, 2014, 6:42:10 AM12/9/14
to pyst...@googlegroups.com

Andy

unread,
Dec 9, 2014, 11:14:16 AM12/9/14
to pyst...@googlegroups.com
Hi Ben.
This is correct.
A pull request for better documentation would be very welcome.

Best,
Andy

xx
--
You received this message because you are subscribed to the Google Groups "pystruct" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystruct+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dzung Nguyen

unread,
Dec 10, 2014, 6:00:55 PM12/10/14
to pyst...@googlegroups.com
Thanks for the explanation, it's very helpful! I figured out X[0] to be unary potentials (average of TextonBoost potentials inside a superpixel), X[1] is the list of edges and X[2] is edge feature.

Now how can I derive X[2]? Since each superpixel may have 21 values, shouldn't the pairwise potential has size 21x21 instead of 1x3?

--
You received this message because you are subscribed to a topic in the Google Groups "pystruct" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pystruct/KFTl3NM-1IQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pystruct+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Dzung Nguyen

PhD Student
Electrical Engineering and Computer Science,
Northwestern University, IL, USA
http://users.eecs.northwestern.edu/~dtn419/

Andy

unread,
Dec 10, 2014, 6:59:07 PM12/10/14
to pyst...@googlegroups.com
These are features for the pairwise potentials (which I think are a constant, color contrast and relative vertical position), not pairwise potentials.

Dzung Nguyen

unread,
Dec 10, 2014, 7:24:42 PM12/10/14
to pyst...@googlegroups.com
Thanks! Is it possible to elaborate more on edge features? I'm applying the code to a new image database. I also looked over your thesis github but still haven't been able to find how edge features are constructed.

Andy

unread,
Dec 15, 2014, 10:24:30 PM12/15/14
to pyst...@googlegroups.com
On 12/10/2014 07:24 PM, Dzung Nguyen wrote:
> Thanks! Is it possible to elaborate more on edge features? I'm
> applying the code to a new image database. I also looked over your
> thesis github but still haven't been able to find how edge features
> are constructed.
>

Sorry for the slow reply, I was on a conference.
I am not sure I understand you question. An edge feature is just a
single number for each edge in the graph.
They are used in EdgeFeatureGraphCRF to construct data-dependent
pairwise potentials.
GraphCRF does not have any edge features, which means all edges have the
same (n_states, n_states) matrix of pairwise potentials.

For EdgeFeatureGraphCRF, there pairwise features are a linear
combination of one (n_states, n_states) matrix for each feature,
weighted by the feature value.
In math, the pairwise energy associated with the nodes i and j taking on
the values y_i, y_j is

\psi(y_i, y_j) = \sum_{f \in \text{Features}} f_{i, j}\theta_{f, y_i, y_j}

Here \theta is an (n_features, n_states, n_states) tensor and f_{i, j}
is the value of the feature f associated with the edge (i, j).

Let me know if that answers your question.
Reply all
Reply to author
Forward
0 new messages