HTM Anomaly Detection on image encodings problem

Hi,

I am performing some anomaly detection on image encodings, the idea being that images classified as “scorpions” will have similar latent representation to eachother in a CNN, while “cars” will have a different latent representation.

I am testing whether or not a HTM can distinguish the latent representations of “scorpions” from “cars”, by feeding it a sequence of “scorpion” encodings and a few “car” encodings as anomalies. However, I am met with the following problem:Figure_1
The anomaly score spike that occurs at x=622 happens no matter what image is seen at x=622 (a car, a scorpion, Obi-Wan, all give a high anomaly score). Skipping image 622 makes image 623 output a high anomaly score. So it seems to me that the HTM outputs a high anomaly score based on some previously occcuring image(s). My question is whether or not there is a parameter that can help control this behaviour?

I am currently running the experiment using fixed seeds for reproducability, and my parameters are as follows:

Encoder:

RDSE (input_shape=512 (floats), output_shape=512000)
size=1000
sparsity=0.1
resolution=0.01

Spatial Pooler:

potentialPct=0.3
potentialRadius=2048
localAreaDensity=0.04
columnDimension=1000

Temporal Memory:

columnDimensions=1000

Rest are default, as set in HTM.Core.