Enable AOI analysis

Once ArFrame is configured and 2D AOI are described, fixation can be matched with AOI to build an AOI scan path before analyzing it.

Layer

Add ArLayer to ArFrame JSON configuration

The ArLayer class defines a space where to match fixations with AOI and inside which those matches need to be analyzed.

Here is an extract from the JSON ArFrame configuration file with a sample where one layer is added:

{
    "argaze.ArFeatures.ArFrame": {
        "name": "My FullHD screen",
        "size": [1920, 1080],
        ...
        "layers": {
            "MyLayer": {
                "aoi_scene" : {
                    "GeoSector": [[860, 160], [1380, 100], [1660, 400], [1380, 740], [1440, 960], [920, 920], [680, 800], [640, 560]],
                    "LeftPanel": {
                        "Rectangle": {
                            "x": 0,
                            "y": 0,
                            "width": 350,
                            "height": 1080
                        }
                    },
                    "CircularWidget": {
                        "Circle": {
                            "cx": 1800,
                            "cy": 120,
                            "radius": 80
                        }
                    }
                },
                "aoi_matcher": {
                    "argaze.GazeAnalysis.DeviationCircleCoverage.AOIMatcher": {
                        "coverage_threshold": 0.5
                    }
                },
                "aoi_scan_path": {
                    "duration_max": 30000
                },
                "aoi_scan_path_analyzers": {
                    "argaze.GazeAnalysis.Basic.AOIScanPathAnalyzer": {},
                    "argaze.GazeAnalysis.TransitionMatrix.AOIScanPathAnalyzer": {},
                    "argaze.GazeAnalysis.NGram.AOIScanPathAnalyzer": {
                        "n_min": 3,
                        "n_max": 5
                    }
                }
            }
        }
    }
}

Note

Timestamped gaze movements identified by the parent ArFrame are passed one by one to each ArLayer. So, the execution of all ArLayers is done during the parent ArFrame.look method call, as explained in the previous chapter.

Now, let's understand the meaning of each JSON entry.

layers

An ArFrame instance can contains multiples ArLayers stored by name.

MyLayer

The name of an ArLayer. Basically, it is useful for visualization purposes.

aoi_scene

The set of 2D AOI into the layer as defined at 2D AOI description chapter.

AOI scene

aoi_matcher

The first ArLayer pipeline step aims to match identified gaze movement with the layer's AOI.

AOI matcher

The matching algorithm can be selected by instantiating a particular AOIMatcher from the GazeAnalysis submodule or from another Python package.

In the example file, the chosen matching algorithm is the Deviation Circle Coverage which has one specific coverage_threshold attribute.

Mandatory

JSON aoi_matcher entry is mandatory. Otherwise, the AOIScanPath and AOIScanPathAnalyzers steps are disabled.

aoi_scan_path

The second ArLayer pipeline step aims to build an AOIScanPath defined as a list of AOIScanSteps made by a set of successive fixations/saccades onto the same AOI.

AOI scan path

Once gaze movements are matched to AOI, they are automatically appended to the AOIScanPath if required.

GazeFeatures.OutsideAOI

When a fixation is not looking at any AOI, a step associated with an AOI called GazeFeatures.OutsideAOI is added. As long as fixations are not looking at any AOI, all fixations/saccades are stored in this step. In this way, further analysis are calculated considering those extra GazeFeatures.OutsideAOI steps.

This is particularly important when calculating transition matrices, because otherwise we could have arcs between two AOIs when in fact the gaze could have fixed itself outside in the meantime.

The AOIScanPath.duration_max attribute is the duration from which older AOI scan steps are removed each time new AOI scan steps are added.

Optional

JSON aoi_scan_path entry is not mandatory. If aoi_scan_path_analyzers entry is not empty, the AOIScanPath step is automatically enabled.

aoi_scan_path_analyzers

Finally, the last ArLayer pipeline step consists of passing the previously built AOIScanPath to each loaded AOIScanPathAnalyzer.

Each analysis algorithm can be selected by instantiating a particular AOIScanPathAnalyzer from the GazeAnalysis submodule or from another Python package.

In the example file, the chosen analysis algorithms are the Basic module, the TransitionMatrix module and the NGram module, which has two specific n_min and n_max attributes.