I have searched through all issues both open and closed that highlight low FPS of simGetImages such as #3333, #3070, #2891 and #3018.
Question
What's your question?
How close are you to resolving the msgpack bottleneck and what are the most up to date tricks that can significantly improve FPS?
I think I saw something about compiling with specific binaries but I had a hard time compiling AirSim before so I don't want to risk it if it's not worth it. If at least 30fps are not attainable then AirSim is not a viable RL simulator.
Include context on what you are trying to achieve
I am training an RL script that takes as input low resolution RGB images (256x256x3) and then takes action. I started with 1-2FPS and started trying everything I could to increase my FPS because training 1 million timesteps took a whooping 5d7h and I can't run experiments that take so long.
I use the following function to make image calls but I have to ensure I am not getting an empty string binary or else training stops (hence the while loop and the .shape==0 check)
def _get_obs(self, responses=None):
while responses is None:
responses = self.image_client.simGetImages(
[airsim.ImageRequest(self.camera_name, self.image_type, False, False)])
img1d = np.fromstring(responses[0].image_data_uint8, dtype=np.uint8)
if img1d.shape == 0:
responses = None
try:
image = np.reshape(img1d, self.image_shape)
except ValueError as e:
print(e)
responses = None
return image
Context details
Specs: Windows 10.0.19044
UE: 4.27.2
AirSim: 1.6
Graphics Card: NVIDIA GeForce GTX 1080 Ti
RAM: 4GB
Python: 3.9.10
msgpack-python 0.5.6
msgpack-rpc-python 0.4.1
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"CameraDefaults": {
"CaptureSettings": [
{
"ImageType": 0,
"Width": 256,
"Height": 256,
"FOV_Degrees": 84
}
]
},
"Gimbal": {
"Stabilization": 0.6,
"Pitch": -90, "Roll": 0
},
"Recording": {
"RecordOnMove": true,
"RecordInterval": 0.05,
"Folder": "D:\\Documents\\AirSim\\Recordings",
"Enabled": false,
"Cameras": [
{ "CameraName": "3", "ImageType": 0, "PixelsAsFloat": false, "VehicleName": "SimpleFlight", "Compress": true }
]
},
"Vehicles": {
"SimpleFlight": {
"VehicleType": "SimpleFlight",
"X": 2, "Y": 0, "Z": 0.0,
"Pitch": -15.0, "Roll": 0.0,"Yaw": 0.0,
"Sensors": {
"Distance": {
"SensorType": 5,
"Enabled" : true,
"MinDistance": 0.05,
"MaxDistance": 80,
"X": 0, "Y": 0, "Z": -1,
"Pitch": -90, "Roll": 0, "Yaw": 0,
"DrawDebugPoints": false
}
}
}
}
}
Include details of what you already did to find answers
I have tried the following:
- Request uncompressed images (you can see the code I used above)
- Using separate image and drone clients -> No improvement
- Setting "ViewMode" :"NoDisplay" -> No improvements
- Decreasing duration of step_size during movement -> x2.5 improvement (from 0.25 to 0.1)
- removing .join() from self.client.moveByVelocityAsync(vx, vy, vz, duration=0.1).join() --> 17fps
- increase wallclockspeed from x1 to x3 ->19fps
- Replaced simGetImages with simGetImage -> No improvements
Steps 4 and 5 cause instabilities (when evaluating a trained example that used asynchronous steps or increased wallclockspeed, it's behaviour was worse than random. An example trained for 1million time steps without using 4 and 5 converged to the expected behaviour). With everything I tried I am running training with 5-7 FPS.
I have searched through all issues both open and closed that highlight low FPS of simGetImages such as #3333, #3070, #2891 and #3018.
Question
What's your question?
How close are you to resolving the msgpack bottleneck and what are the most up to date tricks that can significantly improve FPS?
I think I saw something about compiling with specific binaries but I had a hard time compiling AirSim before so I don't want to risk it if it's not worth it. If at least 30fps are not attainable then AirSim is not a viable RL simulator.
Include context on what you are trying to achieve
I am training an RL script that takes as input low resolution RGB images (256x256x3) and then takes action. I started with 1-2FPS and started trying everything I could to increase my FPS because training 1 million timesteps took a whooping 5d7h and I can't run experiments that take so long.
I use the following function to make image calls but I have to ensure I am not getting an empty string binary or else training stops (hence the while loop and the .shape==0 check)
Context details
Specs: Windows 10.0.19044
UE: 4.27.2
AirSim: 1.6
Graphics Card: NVIDIA GeForce GTX 1080 Ti
RAM: 4GB
Python: 3.9.10
msgpack-python 0.5.6
msgpack-rpc-python 0.4.1
{ "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md", "SettingsVersion": 1.2, "SimMode": "Multirotor", "CameraDefaults": { "CaptureSettings": [ { "ImageType": 0, "Width": 256, "Height": 256, "FOV_Degrees": 84 } ] }, "Gimbal": { "Stabilization": 0.6, "Pitch": -90, "Roll": 0 }, "Recording": { "RecordOnMove": true, "RecordInterval": 0.05, "Folder": "D:\\Documents\\AirSim\\Recordings", "Enabled": false, "Cameras": [ { "CameraName": "3", "ImageType": 0, "PixelsAsFloat": false, "VehicleName": "SimpleFlight", "Compress": true } ] }, "Vehicles": { "SimpleFlight": { "VehicleType": "SimpleFlight", "X": 2, "Y": 0, "Z": 0.0, "Pitch": -15.0, "Roll": 0.0,"Yaw": 0.0, "Sensors": { "Distance": { "SensorType": 5, "Enabled" : true, "MinDistance": 0.05, "MaxDistance": 80, "X": 0, "Y": 0, "Z": -1, "Pitch": -90, "Roll": 0, "Yaw": 0, "DrawDebugPoints": false } } } } }Include details of what you already did to find answers
I have tried the following:
Steps 4 and 5 cause instabilities (when evaluating a trained example that used asynchronous steps or increased wallclockspeed, it's behaviour was worse than random. An example trained for 1million time steps without using 4 and 5 converged to the expected behaviour). With everything I tried I am running training with 5-7 FPS.