How should I encode low res RGB image for OpenAI minigrid gym

Im trying to use an htm net as part of my agent to play the minigrid gym, and am wondering if i should encode each rgb values a a scalar, or filter it into individual r g and b binary pixel representations, then feed it to an sdr?

1 Like

I sort of had the same question , I think it kind of depends what the percentage of sparsity you want maintain , i processed individual R. and G and B bytes individually onto there own networks . roughly bringing the sparsity to 8% : 8 bits for 100 neurons at a time

1 Like

Not really familiar to me but they seem more like a limited small size grid where each cell is either empty or contains some thing. Where thing could be either “player”, “target”, “wall”, “lava” and so on.

The point is you’ll be better off (cheaper to train) with representing grid world state by encoding directly these symbols into a SDR at cell resolution than trying to meaningfully process the rgb, (pixel level) images

2 Likes

I just found out the pixels are actually 3 enums, not RGB values, that represent attributes. The state is a 7x7 grid of 3 enums: <object_type, color, doors_state>. I could encode the object_type by dividing the type up into a different SDR for each type, but the problem then is that the SDR could potentially be 100% on. E.g. All cells are lava. I suppose I could just make it so that 100% of on pixels is still just a small percentage of the entire SDR.

1 Like

Thinking about this again, I don’t need to worry about being 100% full of an object, because if I preprocess the image into separate binary filtered images by each object type, and then concatenate them together, then it will be sparse no matter what since there can usually only be one object type in a single space. E.g. 100% lava will have all lava bits filled, but all the other bits will be 0.

1 Like