minosworld / minos

MINOS: Multimodal Indoor Simulator
MIT License
201 stars 33 forks source link

SUNCG scene loading speed #142

Open gliese581gg opened 5 years ago

gliese581gg commented 5 years ago

Hi! I tried to load scenes from SUNCG dataset and there seems to be large loading speed difference between Ids incorporated in scenes.multiroom.csv and random Ids.

For example, loading

0004d52d1aeeb8ae6de39d6bd993e992 0004dd3cb11e50530676f77b55262d38 000514ade3bcc292a613a4c2755a5050 00052c0562bde7790f8354e6123ae7ff 000539881d82c92e43ff2e471a97fcf9 0005b50577f5871e1c0bb7a687f6cbc3 0005b92a9ed6349df155a462947bfdfe 00065ecbdd7300d35ef4328ffe871505 000cf80f9ff74db95a46cd3a269a6e7c 000d0395709d2a16e195c6f0189155c4

take a lot of time and sometimes connection to the server is lost somehow.

However, I don't have any issues when loading

'004667ffa2594fa780e84d7b979f25ab', '0049e2ed9d7b7c49930d92c30fd59ff7', '00a76592d5cc7d92eef022393784a2de', '00f51d7ba0a47f2c26149e4fa86c237d', '0161a4ab2e4fa6aa12dab13c170c2fd6', '02009ca0f3f2148d63a5f295f1140be3', '022dfd041b20219d2170ffe1134bc444', '047dbcc70a693132ae860b9c73741483', '05fc50487eb1da4939e5a4905b1776ea', '0713fb7a2528bcb31e6a696894f8d462',

I wonder what is the difference .

It will be very nice If I can load any Ids as fast as those in csv file.

I used same code for both Ids

Below is code I used.

from minos.lib import Simulator as SIM
from minos.config.sim_args import parse_sim_args
import argparse,time
#import cv2

parser = argparse.ArgumentParser(description='MINOS gym wrapper')
args = parse_sim_args(parser)
args['color_mode']='rgba'

'''
################################################
Below list contains random Ids
################################################
'''
#scene_list = open('/media/jychoi/NAS_1/Dataset/suncg/scene_list.txt','r').readlines()
scene_list = [
'0004d52d1aeeb8ae6de39d6bd993e992',
'0004dd3cb11e50530676f77b55262d38',
'000514ade3bcc292a613a4c2755a5050',
'00052c0562bde7790f8354e6123ae7ff',
'000539881d82c92e43ff2e471a97fcf9',
'0005b50577f5871e1c0bb7a687f6cbc3',
'0005b92a9ed6349df155a462947bfdfe',
'00065ecbdd7300d35ef4328ffe871505',
'000cf80f9ff74db95a46cd3a269a6e7c',
'000d0395709d2a16e195c6f0189155c4',
]

'''
################################################
Below list contains Ids from scenes.multiroom.csv
################################################
'''
'''
scene_list=['004667ffa2594fa780e84d7b979f25ab',
'0049e2ed9d7b7c49930d92c30fd59ff7',
'00a76592d5cc7d92eef022393784a2de',
'00f51d7ba0a47f2c26149e4fa86c237d',
'0161a4ab2e4fa6aa12dab13c170c2fd6',
'02009ca0f3f2148d63a5f295f1140be3',
'022dfd041b20219d2170ffe1134bc444',
'047dbcc70a693132ae860b9c73741483',
'05fc50487eb1da4939e5a4905b1776ea',
'0713fb7a2528bcb31e6a696894f8d462',]
'''

sim = SIM.Simulator(args)

sim.init()

sim.start()

tt = time.time()

for j in range(10):

    msg = {}
    msg['scene']={}
    msg['scene']['fullId'] = 'p5dScene.%s'%scene_list[j].strip()
    print(msg['scene']['fullId'])
    sim.restart_child_servers(randomize_ports=True)
    sim.init()
    sim.configure(msg)
    sim.start()
    sim.reset()

    print('Room %d'%j)

    for i in range(1):
        observation = sim.step( {'name':'turnLeft'} ,1)
        #o = sim.get_last_observation()
        m = sim.get_scene_data()
        rgb = observation["observation"]["sensors"]["color"]["data"]
        if i==0 : print(m['data']['sceneId'])
        #print(list(m['data']['scene'].keys()))
        #cv2.imshow('sdf',cv2.cvtColor(rgb[:,:,:3],cv2.COLOR_BGR2RGB))
        #cv2.waitKey(1)

print(time.time()-tt)
angelxuanchang commented 5 years ago

The load time of scenes will vary based on the size of the scene and the number of objects and rooms in the scene. We recommend you store all data on local ssd for fast file system access.