peteanderson80 / Matterport3DSimulator

AI Research Platform for Reinforcement Learning from Real Panoramic Images.
Other
481 stars 129 forks source link

"IndexError" occurs when using simulator API in Python. #96

Closed picksh closed 2 years ago

picksh commented 3 years ago

Hi, I am currently trying the Simulator. I am using the latest version and Building using Docker. Following the instructions, I passed all tests. However, when I try the Python API, there is a error:

IndexError: vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)

for:

sim.newEpisode(['2t7WUuJeko7'], ['1e6b606b44df4a6086c0f97e826d4d15'], [0], [0])

The full code is also attached:

 if __name__=='__main__':
    VFOV = math.radians(60)
    sim=MatterSim.Simulator()
    sim.setCameraResolution(640, 480)
    sim.setCameraVFOV(VFOV)
    sim.setPreloadingEnabled(True)
    sim.setDepthEnabled(False)
    sim.setBatchSize(100)
    sim.setCacheSize(200)  # cacheSize 200 uses about 1.2GB of GPU memory for caching pano textures
    sim.initialize()
    sim.newEpisode(['2t7WUuJeko7'], ['1e6b606b44df4a6086c0f97e826d4d15'], [0], [0])

I am using a headless machine with ubuntu18.04 and my gcc version is 7.5.0. I think there might be some problem with "using python lists in place of C++ std::vectors" but just a guess and I can not fix it. I would appreciate any infomation you could give me.

jacobkrantz commented 2 years ago

This line assumes a batch size of 1:

sim.newEpisode(['2t7WUuJeko7'], ['1e6b606b44df4a6086c0f97e826d4d15'], [0], [0])

but earlier you set sim.setBatchSize(100). The IndexError goes away for me when I use a proper batch size, in this case 1.

picksh commented 2 years ago

Thanks a lot!