Patent Publication Number: US-9846845-B2

Title: Hierarchical model for human activity recognition

Description:
BACKGROUND 
     Field 
     Embodiments presented herein provide techniques for recognizing and analyzing human activity in multi-person scenes and, in particular, recognizing activity using a hierarchical model which describes human behavior at multiple levels of detail. 
     Description of the Related Art 
     Automated human activity recognition has focused on recognition of low-level single-person actions or, alternatively, higher levels of abstraction, such as scene-level representations of activity. Where higher levels of abstraction are recognized, activity at lower levels typically have been treated as latent intermediate representations of little inherent interest. The accuracy of such approaches in recognizing human activity is limited. 
     SUMMARY 
     One embodiment of the invention includes a computer implemented method for recognizing and analyzing activities. The method includes learning parameters of a classifier in a training operation based on feature vectors and activity elements corresponding to objects during one or more annotated example executions, where the classifier represents activity elements at multiple levels of detail. The method further includes extracting feature vectors corresponding to objects that interact during a test execution, determining, based on the extracted feature vectors and using the classifier, activity elements associated with the one or more objects, at the multiple levels of detail 
     Other embodiments include a computer-readable medium that includes instructions that enable a processing unit to implement one or more aspects of the disclosed methods as well as a system configured to implement one or more aspects of the disclosed methods. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       So that the manner in which the above recited aspects are attained and can be understood in detail, a more particular description of aspects of the invention, briefly summarized above, may be had by reference to the appended drawings. 
       It is to be noted, however, that the appended drawings illustrate only typical aspects of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective aspects. 
         FIG. 1A  illustrates an example hierarchical model for recognizing and analyzing activities, according to an embodiment of the invention. 
         FIG. 1B  illustrates an example graph for representing mid-level social roles and interactions, according to an embodiment of the invention. 
         FIG. 2  illustrates a method for determining social roles from multi-person scenes using a hierarchical model, according to an embodiment of the invention. 
         FIG. 3  depicts a block diagram of a system in which an embodiment may be implemented. 
     
    
    
     DETAILED DESCRIPTION 
     Embodiments disclosed herein provide techniques for recognizing and analyzing activities. Although, in describing this invention the focus is on activities related to team games, embodiments of this invention may be applied to any activity or interaction involving a group of objects. In one embodiment, a learning application trains parameters of a hierarchical model, based on annotated example execution(s) (i.e., occurrences) of the game (or other group activity or interaction), where the hierarchical model represents activity elements, discussed below, at multiple levels of detail. Higher levels of detail may consider more context provided by behavior of other persons, and vice versa. In general, the model may represent levels of detail relating to actions of individuals, their social roles and interactions, and an overall event depicted in a scene. For example, in the context of field hockey, the model may include a model (i.e. any classifier) used to predict individual actions (e.g., “pass,” “shot,” etc.), as well as higher-level models used to predict social roles (e.g., “attacker,” “defender,” etc.) and overall scene events (e.g., “attack play,” “penalty corner,” etc.). Learning may be optimized for a user-preferred inference by adjusting learning criteria (e.g., a loss function) while leaving the hierarchical structure of the model unchanged. 
     An inference application may use the trained model to respond to queries about any variable(s) at any level of detail in test execution(s) (i.e., occurrences of the game or group activity or interaction for which inferences are to be made). For example, queries may be directed to the actions or social roles of a particular person, to the overall event depicted in the scene, etc., or a combination of these. In one embodiment, the inference application may determine scores for each possible value of the query variable(s) (e.g., each possible action where the query is directed to actions of a particular person) by finding the best hierarchical event representation that maximizes a scoring function while fixing the value of the query variable to its possible values. In such a case, the inference application may also approximately determine the best hierarchical event representation by iteratively optimizing one level-of-detail variable at a time while fixing other level-of-detail variables, until convergence. 
     The following description references aspects of the disclosure. However, it should be understood that the disclosure is not limited to specific described aspects. Instead, any combination of the following features and elements, whether related to different aspects or not, is contemplated to implement and practice the disclosure. Furthermore, although aspects of the disclosure may achieve advantages over other possible solutions and/or over the prior art, whether or not a particular advantage is achieved by a given aspect is not limiting of the disclosure. Thus, the following aspects, features, and advantages are merely illustrative and are not considered elements or limitations of the appended claims except where explicitly recited in a claim(s). Likewise, reference to “the disclosure” shall not be construed as a generalization of any inventive subject matter disclosed herein and shall not be considered to be an element or limitation of the appended claims except where explicitly recited in a claim(s). 
     Aspects of the present disclosure may be embodied as a system, method or computer program product. Accordingly, aspects of the present disclosure may take the form of an entirely hardware aspect, an entirely software aspect (including firmware, resident software, micro-code, etc.) or an aspect combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present disclosure may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon. 
     Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus or device. 
     The flowchart and block diagrams in the Figures illustrate the architecture, functionality and operation of possible implementations of systems, methods and computer program products according to various aspects of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. Each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by special-purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. 
       FIG. 1A  illustrates an example hierarchical model  110  for recognizing and analyzing human (or any other objects&#39;) activity, according to an embodiment. As shown, the hierarchical model  110  includes multiple levels of detail. Higher levels of detail may account for more context provided by behavior of additional persons (or objects), and vice versa. Illustratively, the hierarchical model  110  includes a low-level model  112  of an individual&#39;s actions, a mid-level model  113  of social roles and interactions, and a high-level model of events  116 . Of course, the hierarchical model  110  may include additional levels of detail. For example, the hierarchical model  110  may include a level above the high-level model of events  116  which models a type of activity (e.g., a sport) to which the events belong. 
     As used herein, “activity element” refers to a type of activity at a level of detail, e.g., an action of an object, a social role of an object, an event within a game, etc. In general, the hierarchical model  110  may represent a set of graph structures (e.g. directed or undirected graphs) which include activity elements at multiple levels of detail as vertices, as well as edges connecting any set of the vertices. Here, the edges may connect vertices at the same level of detail and vertices at different levels of detail. 
     Processing each video frame, regions of the video image that correspond to objects&#39; foreground (or outline) may be extracted. Pixels associated with these foregrounds are characterized by various features  111  such as color, shape, optical flow, or texture. For example, histogram of oriented gradient (HOG) features may be extracted from a person&#39;s bounding box  101 - 104 . Various characteristic features may be extracted from the current frame image or from multiple-video-frame tracklets  100   a - 100   c  and may be concatenated to create the feature vector. The low-level model  112  models compatibility between a person&#39;s feature vector and potential actions which the person may be performing. At the mid-level  113 , the model  110  accounts for contextual information by modeling interactions between persons in terms of their social roles, which naturally capture important interactions between persons. The high-level model  116  represents scene-level events, which are dependent on the social roles. That is, the events of high-level model  116  may depend on the social roles and interactions of the underlying mid-level model  113 , which may themselves depend on the actions of low-level model  112 , and vice versa. For example, during certain events a person with a given social role may tend to appear in a certain position in the scene. In general, incorporating multiple levels of detail into the hierarchical model  110  helps account for the fact that, e.g., persons having some social roles may be more likely to perform certain actions, and vice versa, as well as account for interdependencies between other levels of detail. Doing so permits improved activity recognition at the action level, the social role level, the scene event level, etc., as well as combinations of such levels. 
     The hierarchical model  110  may be adapted to any application domain in which group activities or interactions occur. Examples include sports videos, interactive video games, surveillance footage, etc. The model may be derived from video or from any sensory data from which objects&#39; characteristic information may be extracted. Illustratively, the hierarchical model  110  has been adapted to video frames  100   a - 100   c  of the sport field hockey. Here, low-level actions of individual players may generally be divided into classes such as “pass,” “receive,” “dribble,” “shot,” “tackle,” “prepare,” “stand,” “jog,” “run,” “walk,” “save,” and the like. Of course, actions in other activities than field hockey would be divided into different classes. Mid-level social roles in field hockey may be divided into classes such as “attacker,” “first defender,” “defender defending against person,” “defender defending against space,” and “other.” The “attacker” is someone who controls the ball and the defenders may be classified as “first defenders” if they defend against the attacker and otherwise as defenders defending against person or defenders defending against space. Players from the same team as the attacker, the referee, and the goalie may be assigned the “other” label. In this model, each person in the scene may be labeled with both an action and a social role. For example, someone depicted as shooting the ball may be labeled with the action “shot” and further labeled with the social role “attacker.” Additionally, the overall event depicted by the field hockey video may be labeled as one of a number of classes, such as “attack play,” “free hit,” “penalty corner,” and the like. 
     As discussed, the model  110  is a discriminative model which may be used to learn structures of connectivity (i.e. graphs) among activity elements, where a graph&#39;s vertices may correspond to activity elements at various levels of detail and the graph may further include a set of edges between activity elements. Here, the edges may represent, for example, interactions between social roles, but edges may also represent other correlations and statistical relationships depending on the particular activity elements which the edge connects. Parameters of the model may be learned based on video(s) of example execution(s) (i.e., occurrences) of the games (other group activities or interactions) or any other means of capturing (e.g. telemetry) the examples. One possible graph for the scene depicted in the multiple-video-frame tracklets  100   a - 100   c  is illustrated in  FIG. 1 . 
     After learning, the model  110  provides a framework which may be used for making various inferences in test execution(s), depending on user preferences. In particular, the structure of the model  110  may remain unchanged while learning criteria (e.g., a loss function&#39;s parameters) are altered, thereby optimizing learning for a user-preferred inference. In the case of field hockey, user-preferred inferences may include, for example, finding the “attacker,” recognizing the action or social role of each player, etc. 
     As discussed, in one embodiment, each depicted person may be associated with two labels: action and social role. Let h i ε  and r i ε  be the action and social role of person i, respectively, where   and   are the sets of possible action and social role labels, respectively. In addition, each segment from a video sequence may be associated with an event label yε , where   is the set of possible event labels. Hence, a video sequence may include several events each associated with a different segment within the sequence. Then a score for interpreting video sequence I with a hierarchical event representation may be defined, for example, as:
 
 F   w ( x,y,r,h,I )= w   T Φ( x,y,r,I )=Σ j   w   1   T φ 1 ( x   j   ,h   j )+Σ j   w   2   T φ 2 ( h   j   ,r   j )+Σ j,k   w   3   T φ 3 ( y,r   j   ,r   k )+Σ j   w   4   T φ 4 ( r   j   ,y ),  (1)
 
where w 1   T φ 1 ( x   j ,h j ) is an action model, w 2   T φ 2 (h j ,r j ) is a unary role model, Σ j,k w 3   T φ 3 (y, r j , r k ) is a pairwise role model, and Σ j w 4   T φ 4  (r j , y) is an event model.
 
     The action role model w 1   T φ 1 (x j ,h j ) is a potential function, and may be a standard linear model for predicting an action label of the j-th person. For example, the action role model w 1   T φ 1 (x j ,h j ) may be parameterized as:
 
 w   1   T φ 1 ( x   j   ,h   j )=   w   1b   T   ( h   j   =b )· x   j ,  (2)
 
where x j  is the feature vector associated with the j-th person. As discussed, various features may be extracted from, e.g., the j-th person&#39;s bounding box (or image foreground) in one or multiple video-frame tracklets based on data analysis, and the extracted features may be concatenated to create the feature vector x j . In one embodiment, the feature vector x j  may not be a vector of raw features, but rather an N-dimensional vector in which the k-th entry is a score of classifying for instance using a multi-class classifier (e.g., a support vector machine classifier) trained based on raw features and associated actions. Note, any discriminative feature known in the art, such as features based on color, texture, shape, optical flow, depth, etc., may be used.
 
     The unary role model w 2   T φ 2 (h j , r j ) is a potential function which represents the properties of social roles, including dependencies between the action h j  and the social role r j  of the j-th person. The unary role model w 2   T φ 2 (h j , r j ) may be used to predict the social role of a person in the scene without considering other persons, and parameterized, for example, as: 
                       w   2   T     ⁢       ϕ   2     ⁡     (       h   j     ,     r   j     ,   I     )         =         ∑     c   ∈   ℛ       ⁢       ∑     b   ∈   ℋ       ⁢         w     2   ⁢   c   ⁢           ⁢   b       ·     ⁢       (       h   j     =   b     )     ·     ⁢     (       r   j     =   c     )           +       ∑     c   ∈   ℛ       ⁢       ∑     m   ∈   ℳ       ⁢         w     2   ⁢           ⁢   c   ⁢           ⁢   k       ·     ⁢       (       r   j     =   c     )     ·         bin   m     ⁡     (   j   )       .                       (   3   )               
Here, each video frame is divided into M cells, and bin m (j)=1 if the j-th person is depicted in the m-th cell, and 0 otherwise. In one embodiment, such spatial binning is performed with respect to a reference. Doing so permits bin m (j) to be invariant to changes in camera view. For example, in the case of field hockey, the goal may be used as the reference such that, if the goal appears at the left of the video frame, then the first bin may start at the bottom left of the image, and vice versa if the goal appears at the right of the video frame. In an embodiment, the spatial binning may be performed with respect to a real-world coordinate system. This may be accomplished by calibrating the camera, a process that allows mapping positions in image space to their corresponding 3D real-world position.
 
     The pairwise role model Σ j,k w 3   T φ 3 (y, r j , r k ) is a potential function which represents dependencies between a pair of social roles r j  and r k  under an event y. The pairwise role model Σ j,k w 3   T φ 3 (y, r j , r k ) may be used to predict the social role of a person in the scene while considering the roles of other persons, and parameterized, for example, as:
 
 w   3   T φ 3 ( y,r   j   ,r   k )=       w   3abc   T   ( y=a )· ( r   j   =b )· ( r   k   =c )· d   jk   +       w   3abc   T · ( r   j   =b )· ( r   k   =c )· g   jk .  (4)
 
Here, d jk  is the feature that bins the relative locations of the j-th and k-th persons into one of D spatial relations, such as “overlap,” “next-to,” “near,” “above,” “below,” and the like. More specifically, d jk  may be represented as a sparse vector of all zeros except a single one for the bin occupied by the satisfied spatial relation. As discussed, binning may be performed with respect to a reference, e.g., in the 2D image space or the 3D real-world space. For example, in the case of field hockey, d jk  may be defined as “above” when the goal appears at the right of an image and the j-th person appears to the right of the k-th person in the image. In addition, g jk  is a two-dimensional vector equal to [1, 0] if the j-th and k-th persons are on the same team, and to [0,1] otherwise.
 
     The event model Σ j w 4   T φ 4 (r j , y) is potential function which represents the properties of scene-level events, including dependencies between the social role r j  of the j-th person and the overall event depicted in the scene y. Similar to the unary role model, the event model Σ j w 4   T φ 4 (r j , y) may be parameterized, for example, as: 
                         ∑   j     ⁢       w   4   T     ⁢       ϕ   4     ⁡     (       r   j     ,   y     )           =         ∑     d   ∈   ??       ⁢       ∑     c   ∈   ℛ       ⁢         w     4   ⁢   d   ⁢           ⁢   c       ·     ⁢       (       r   j     =   c     )     ·     ⁢     (     y   =   d     )           +       ∑     c   ∈   ℛ       ⁢       ∑     m   ∈   ℳ       ⁢         w     4   ⁢           ⁢   c   ⁢           ⁢   k       ·     ⁢       (       r   j     =   c     )     ·       bin   m     ⁡     (   j   )                   ,           (   5   )               
where the video frame is divided into M cells, and bin m (j)=1 if the j-th person is depicted in the m-th cell, and 0 otherwise.
 
       FIG. 1B  illustrates an example graph for representing mid-level social roles and interactions, according to an embodiment. As discussed, a hierarchical model may represent a set of graph structures (e.g. directed or undirected graphs) which include activity elements at multiple levels of detail as vertices, as well as edges connecting any set of the vertices at the same level of detail and at different levels of detail. Parameters of the hierarchical model may be learned based on video(s) of example execution(s) or any other means of capturing (e.g. telemetry) the examples. Then, as discussed in greater detail below, an inference application may iterate over possible graphs represented by the hierarchical model to optimize one or more activity elements for test execution(s). 
     Illustratively, an undirected graph  =( ,  ) may be used to represent one part of a hierarchical model graph, namely a graph of the mid-level social roles and interactions, with vertices v i ε  of the graph corresponding to social roles r i  and edges (v j ,v k )ε  corresponding to interactions between social roles r i  and r j . In one embodiment in which the social roles r i  include a central figure (e.g., an “attacker,” a leader, etc.) who affects all others, the central figure may be connected to every other person in the graph  , whereas each of the other persons may be connected only to the nearby person(s) within a distance of ε. Of course, other graph structures may be used, depending on the application. 
     Illustratively, the video frame  120  depicts a field hockey scene in which a player  123  is shooting a ball  123   a , while other players  121 - 122  and  124 - 126  converge on the shooting player  123 . As shown, mid-level social roles and interactions in the video frame  120  may be represented by a graph which connects the shooting player  123 , whose role is that of “attacker” (i.e., a central figure affecting all others), to each of the other players—who may be “first defenders,” “other,” etc. —via edges  130   1 - 130   5 . The graph connects player pairs  121 - 122  and  125 - 126 , each having players less than a distance ε from the other players, via edges  140   1  and  140   2 . 
       FIG. 2  illustrates a method  200  for determining social roles from multi-person scenes using a hierarchical model, according to an embodiment. As shown, the method  200  begins at step  210 , where a learning application trains parameters of a hierarchical model with training examples using user-preferred learning criteria. As discussed, the hierarchical model may generally represent human activities at multiple levels of detail. Given a set of N training example(s)  x n , y n , h n , r n , l n    (1, 2, . . . , N) which capture example execution(s) of the game (or other group activity or interaction) and include annotations, the learning application trains the parameter vector w T ≡[w 1   T , w 2   T , w 3   T , w 4   T ]. 
     In one embodiment, the following example structured support vector machine (SVM) formulation may be used to learn the model:
 
min w,ξ≧0 ½ ∥w∥   2   +CΣ   n=1   N ξ n  
 
 s.t.F   w ( x   n   ,y   n   ,h   n   ,r   n   ,l   n )− F   w ( x   n   ,y,h,r,l   n )≧Δ( y,y   n   ,h,h   n   ,r,r   n )−ξ n   ,∀n,y,h,r,   (6)
 
where Δ(y, y n , r, r n , h, h n ) measures the joint loss between the ground-truth event label, social role labels, and action labels (y n , r n , h n ) compared with the hypothesized labels (y, r, h). Here, the joint loss function may be defined, for example, as a weighted combination of the loss on different terms:
 
Δ( y,y   n   ,r,r   n   ,h,h   n )=Δ 0/1 ( y,y   n )+νΣ i Δ 0/1 ( r   i   ,r   i   n )+(1−μ−ν)Σ i Δ 0/1 ( h   i   ,h   i   n ),  (7)
 
where 0≦μ≦1, 0≦ν≦1 balance the contribution terms. This learning framework may be used to carry out different inferences based on a user&#39;s preferences. For example, the user may prefer to use the model to find a central figure such as an “attacker,” to recognize actions and social roles for each player, etc. The loss function may be chosen to optimize learning for such a user-preferred inference, while the model structure remains constant. For example, if the user prefers social role recognition, the value of μ in equation (7) may be set to zero to make the formulation directly optimize social roles. The optimized model parameters in such a case may, for example, misinterpret actions and events to make better predictions about social roles. That is, the parameters may be optimized such that the model may correctly predict social roles by making less correct predictions about actions and events.
 
     Although described above with respect to a multi-class classification problem in which performance would typically be measured by overall accuracy and the learning approach used is to directly optimize the overall accuracy by 0-1 loss Δ 0/1  defined in equation (7), alternative embodiments may include imbalanced datasets (e.g., the number of central figures is very small compared to the number of training examples) for which overall accuracy would not be an appropriate measurement of performance. In such case, mean per-class accuracy may be a better performance measurement, and the loss function may, for example, be chosen to adjust the loss according to the distribution of the classes on the training data: 
                       Δ   bal     ⁡     (     u   ,     u   n       )       =     {           1     m   p                 if   ⁢           ⁢   u     ≠       u   n     ⁢           ⁢   and   ⁢           ⁢     u   n         =   p             0       otherwise                   (   8   )               
where m p  is the number of examples with class label p. Assuming N training examples, Σ n=1   N  Δ bal (u, u n ) directly corresponds to the mean per-class accuracy on the training data. Use of Δ bal (u, u n ) as the loss function directly maximizes the mean per-class accuracy, rather than the overall accuracy.
 
     At step  220 , an inference application receives a set of video frames for analysis. The video frames may generally depict any scene or scenes in which test execution(s) of a game or other group activit(ies) or interaction(s) may occur, such as a scene from a sports game or an interactive video game, surveillance footage, etc. 
     At step  230 , the inference application preprocesses the received video frames of the test execution(s) to identify persons in the video frames and extract features (e.g., HOG features) corresponding to each person. Person detection and feature extract may be performed using any feasible techniques. For example, to encode temporal information, multiple-video-frame tracklets may be extracted for each person based on data association, and features extracted from each person&#39;s bounding box may be concatenated to create feature vectors for those persons. Note, in such a case, training at step  220  would also typically be based on feature vectors of the same kind. In yet another embodiment, the feature vector may not be a vector of raw features, but rather an N-dimensional vector in which the k-th entry is a score of classifying the instance using a multi-class classifier trained based on raw features and associated actions. In embodiments involving teams of persons, such as team sports, the inference application may further separate the persons into different teams (e.g., based on the color histogram of each person). 
     At step  240 , the inference application infers an answer to a query about the received video frames of the test execution(s) based on the extracted features and the trained hierarchical model. As discussed, a user may wish to pose a variety of queries for any given set of video frames. The hierarchical model disclosed herein can formulate queries about any individual variable at any level of detail. Queries may be formulated about the overall event label y for the scene, or the social role label r j  of a person in the scene, etc. For example, in the context of field hockey, a query may ask what action (e.g., “running,” “standing,” etc.) a particular person is engaging in. As another example, the query may ask what overall event (“attack play,” “penalty corner,” etc.) is taking place. Of course, a query may also ask, e.g., both what action a particular person is engaging in and what overall event is taking place. 
     Given a video and a query variable q, the inference problem may be defined as finding a hierarchical event representation that maximizes the scoring function F w (x, y, h, r, I) while fixing the value of q to its possible values. The margin, or difference in model scores between values, for the variable q may be examined to determine a score for its setting. For example, if q is the action of one person (i.e., one of the h i ), then the inference application may compute the maximum value of the scoring function F w  while fixing q to each possible action. The inference application may then set the score for the person performing each action as the difference between the scoring function score when fixing q to that possible action and the scoring function score of the next best action. That is, the inference application may output a vector having such scores for each possible q. 
     For a given video and query variable q, the inference discussed above may include solving an optimization problem which may be written, for example, as:
 
max y,h,r\q   F   w ( x,y,h,r,I )=max y,h,r\q   w   T Φ( x,y,h,r,I ).  (9)
 
Such an optimization problem is generally NP-hard, as it involves a combinatorial search. A coordinate ascent style algorithm may, however, be used to approximately solve equation (9) by iteratively optimizing one variable at a time while fixing the other variables, until converge. At each step of iterative optimization, the inference application may enumerate possible hε  to predict the best action label h*, as action labels lack structure.
 
     Optimizing social roles r is more challenging due to the correlation between r and the graph structure  . As discussed, the graph structure   may itself depend on, for example, who is a central figure, if any. In one embodiment, the inference application may enumerate possible graph structures (k=0, 1, . . . , K) given the hierarchical model, where each k-th person is regarded, one at a time, as the central figure if k≧1, and k=0 corresponds to a further graph in which no person is the central figure. Let r k  be the social roles r when the k-th person is the central figure, i.e., r k =1. In such a case, r may be inferred by solving an optimization problem which may be written, for example, as: 
                     max     0   ≤   k   ≤   K       ⁢       max     r   k       ⁢       w   T     ⁢       Φ   ⁡     (     x   ,   y   ,   h   ,     r   k     ,   I     )       .                 (   10   )               
Here, the inner maximization of r k  with a fixed k is a standard max-inference problem in an undirected graphical model. In one embodiment, loopy belief propagation (BP) may be used to solve the inner max-inference problem.
 
       FIG. 3  illustrates a system  300  in which aspects of the invention may be implemented. As shown, the system  300  includes, without limitation, a central processing unit (CPU)  310 , a network interface  330 , an interconnect  315 , a memory  360  and storage  320 . The system  300  may also include an I/O device interface  340  connecting I/O devices  350  (e.g., keyboard, display and mouse devices) to the system  300 . 
     The CPU  310  retrieves and executes programming instructions stored in the memory  360 . Similarly, the CPU  310  stores and retrieves application data residing in the memory  360 . The interconnect  315  facilitates transmission, such as of programming instructions and application data, between the CPU  310 , I/O device interface  340 , storage  320 , network interface  330 , and memory  360 . CPU  310  is included to be representative of a single CPU, multiple CPUs, a single CPU having multiple processing cores, and the like. And the memory  360  is generally included to be representative of a random access memory. The storage  320  may be a disk drive storage device. Although shown as a single unit, the storage  320  may be a combination of fixed and/or removable storage devices, such as tape drives, removable memory cards or optical storage, network attached storage (NAS), or a storage area-network (SAN). Further, system  300  is included to be representative of a physical computing system as well as virtual machine instances hosted on a set of underlying physical computing systems. Further still, although shown as a single computing system, one of ordinary skill in the art will recognized that the components of the system  300  shown in  FIG. 3  may be distributed across multiple computing systems connected by a data communications network. 
     As shown, the memory  360  includes an operating system  361  and applications  362 - 363 . Illustratively, the operating system may include Microsoft Windows®. The applications  362 - 363  include a learning application  362  and an inference application  363 . The learning application  362  may be configured to train parameters of a hierarchical model  323 , which describes human behavior at multiple levels of detail, based on annotated training examples  321  depicting example executions of a game or other group activity or interaction. As discussed, the training examples  321  may include sample video frame sequences annotated with action, social role, event, and other labels which are appropriate for the hierarchical model  323 . For example, such labels may be supplied by a user. In one embodiment, the learning application  362  may provide a general learning framework which permits training to be tailored for various inferences by modifying learning criteria (e.g., a loss function), as discussed above with respect to step  210  of method  200 . 
     The inference application  363  may use a trained hierarchical model to infer answers to queries about variable(s) at any level of detail for test execution(s), which may be captured, e.g., on video. In one embodiment, the inference application may determine scores for each possible value of the query variable by finding the best hierarchical event representation that maximizes a scoring function while fixing the value of the query variable to its possible values. For example, the inference application may solve, or approximately solve the optimization problem of equation (8), as discussed above with respect to step  240 . 
     Advantageously, techniques disclosed herein may improve the activity recognition of engaging objects in an event captured by video or any other sensory devices at multiple levels of detail. Modeling the connectivity among activity elements throughout an event may be done based on various graph types. In particular, hierarchical models naturally capture the interdependencies between actions, social roles, high-level events, and other levels of detail, and further permit flexible inference of social roles and their dependencies in a given scene. For example, the hierarchical model accounts for the fact that persons having some social roles may be more likely to perform certain actions, and vice versa, as well as interdependencies between other levels of detail. Doing so permits improved activity recognition at the action level, the social role level, the scene event level, etc., as well as combinations of such levels. Further, techniques disclosed herein may be applied to recognize human activities in a variety of settings in which group activities may occur, such as sports games, interactive video games, and security/surveillance. In some applications such as interactive video games, the recognized human activities may be fed back into a system to, for example, adaptively generate content based on the activities. 
     While the foregoing is directed to aspects of the present invention, other and further aspects of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.