Pranay Thangeda commited on
Commit
74f8f8a
1 Parent(s): 8fc0f7c

update usage instructions in readme

Browse files
Files changed (1) hide show
  1. README.md +40 -0
README.md CHANGED
@@ -170,6 +170,46 @@ stiffness = sample['stiffness']
170
  scooped_volume = sample['scooped_volume']
171
  ```
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  ## Dataset Creation
174
 
175
  The dataset was created using the following steps:
 
170
  scooped_volume = sample['scooped_volume']
171
  ```
172
 
173
+ ### Loading All Data for a Specific Terrain ID
174
+
175
+ If you want to load all samples corresponding to a specific terrain ID, you can filter the dataset using the `filter` method. Here's how you can do it:
176
+
177
+ ```python
178
+ # Specify the terrain ID you're interested in
179
+ terrain_id_of_interest = 10 # Replace with the desired terrain ID (1-67)
180
+
181
+ # Filter the dataset to include only samples from the specified terrain
182
+ terrain_samples = dataset.filter(lambda sample: sample['terrain_id'] == terrain_id_of_interest)
183
+
184
+ print(f"Number of samples for terrain {terrain_id_of_interest}: {len(terrain_samples)}")
185
+ for sample in terrain_samples:
186
+ # Load RGB image
187
+ rgb_image = sample['rgb_image'] # PIL Image
188
+
189
+ # Load and reconstruct depth image
190
+ depth_image = sample['depth_image'] # PIL Image
191
+ depth_array = np.array(depth_image).astype(np.float32)
192
+ depth_normalized = depth_array / 65535
193
+ depth_min = sample['depth_min']
194
+ depth_max = sample['depth_max']
195
+ original_depth = depth_normalized * (depth_max - depth_min) + depth_min
196
+
197
+ # Load F/T sensor data
198
+ ft_data = pd.read_csv(sample['ft_csv_path'], header=None).values
199
+
200
+ # Access action parameters
201
+ pixel_x = sample['pixel_x']
202
+ pixel_y = sample['pixel_y']
203
+ yaw = sample['yaw']
204
+ scoop_depth = sample['scoop_depth']
205
+ stiffness = sample['stiffness']
206
+ scooped_volume = sample['scooped_volume']
207
+
208
+ # Perform your analysis or processing here
209
+ # Example: Print scooped volume for each sample
210
+ print(f"Sample {sample['sample_index']}: Scooped volume = {scooped_volume} cubic meters")
211
+ ```
212
+
213
  ## Dataset Creation
214
 
215
  The dataset was created using the following steps: