DAI2020 SMARTS Competition Track 2: Multi-Agent Collaboration Forum

Go back to competition Back to thread list Post in this thread

> Bug in common.cal_img_gray

If we turn use_rgb = True in observation, in function common.cal_img_gray.py
we get the env_obs.top_down_rgb object, but it's a nametuper which have "data & meta_data".
It causes index error, if we replace it to be ```rgb_ndarray = env_obs.top_down_rgb.data``` , the error will not happen.

```sh
File "/home/smart_competition/agents/obs_adapters.py", line 147, in rgb2gray
return np.dot(rgb[..., :3], [0.2989, 0.5870, 0.1140])
TypeError: tuple indices must be integers or slices, not tuple
```
```python
@staticmethod
def cal_img_gray(env_obs: Observation, **kwargs):
resize = kwargs["resize"]

def rgb2gray(rgb):
return np.dot(rgb[..., :3], [0.2989, 0.5870, 0.1140])

rgb_ndarray = env_obs.top_down_rgb
gray_scale = (
cv2.resize(
rgb2gray(rgb_ndarray), dsize=resize, interpolation=cv2.INTER_CUBIC
)
/ 255.0
)
return gray_scale
```

Posted by: leafzs @ Sept. 7, 2020, 1:18 p.m.

Thanks for your bug report, we are going to release the latest version with bug fixed in this Friday. (Sep. 11th, 2020)

Posted by: DAI2020 @ Sept. 9, 2020, 5:42 a.m.
Post in this thread