Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -90,132 +90,371 @@ The natural language text (docstring) is in English.
|
|
90 |
### Data Instances
|
91 |
```
|
92 |
{
|
93 |
-
|
94 |
-
"
|
95 |
-
"
|
96 |
-
"path": "js/scripts.js",
|
97 |
"license": [
|
98 |
"MIT"
|
99 |
],
|
100 |
-
"language": "
|
101 |
-
"identifier": "
|
102 |
-
"
|
103 |
-
"
|
104 |
-
"docstring": "Determines what beepBoop function to use",
|
105 |
"docstring_tokens": [
|
106 |
-
"
|
107 |
-
"what",
|
108 |
-
"beepBoop",
|
109 |
-
"function",
|
110 |
"to",
|
111 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
],
|
113 |
-
"code": "
|
114 |
"code_tokens": [
|
115 |
-
"
|
116 |
-
"
|
|
|
|
|
|
|
117 |
"(",
|
118 |
-
"
|
119 |
-
",",
|
120 |
-
"bbFunction",
|
121 |
")",
|
122 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
"if",
|
|
|
124 |
"(",
|
125 |
-
"
|
|
|
126 |
"==",
|
127 |
"1",
|
128 |
-
"
|
129 |
-
"
|
130 |
"return",
|
131 |
-
"
|
|
|
132 |
"(",
|
133 |
-
"
|
134 |
")",
|
135 |
-
"
|
136 |
-
"
|
137 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
"if",
|
|
|
|
|
|
|
|
|
|
|
139 |
"(",
|
140 |
-
"
|
141 |
-
"==",
|
142 |
-
"2",
|
143 |
")",
|
144 |
-
"
|
145 |
-
"
|
146 |
-
"
|
|
|
|
|
|
|
147 |
"(",
|
148 |
-
"
|
149 |
")",
|
150 |
-
";",
|
151 |
-
"}",
|
152 |
"else",
|
153 |
-
"
|
|
|
|
|
|
|
|
|
|
|
154 |
"(",
|
155 |
-
"
|
156 |
-
"
|
157 |
-
"
|
|
|
|
|
|
|
158 |
")",
|
159 |
-
"
|
160 |
-
"
|
161 |
-
"beepBoop3",
|
162 |
"(",
|
163 |
-
"inputString",
|
164 |
")",
|
165 |
-
"
|
166 |
-
"
|
167 |
-
"
|
168 |
-
"
|
169 |
-
"
|
170 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
],
|
172 |
-
|
173 |
-
"short_docstring": "Determines what beepBoop function to use",
|
174 |
"short_docstring_tokens": [
|
175 |
-
"
|
176 |
-
"what",
|
177 |
-
"beepBoop",
|
178 |
-
"function",
|
179 |
"to",
|
180 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
],
|
182 |
-
"comment": [
|
183 |
-
"
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
{
|
189 |
-
"param": "bbFunction",
|
190 |
-
"type": null
|
191 |
-
}
|
192 |
],
|
|
|
193 |
"docstring_params": {
|
194 |
"returns": [],
|
195 |
"raises": [],
|
196 |
-
"params": [
|
197 |
-
{
|
198 |
-
"identifier": "inputString",
|
199 |
-
"type": null,
|
200 |
-
"docstring": null,
|
201 |
-
"docstring_tokens": [],
|
202 |
-
"default": null,
|
203 |
-
"is_optional": null
|
204 |
-
},
|
205 |
-
{
|
206 |
-
"identifier": "bbFunction",
|
207 |
-
"type": null,
|
208 |
-
"docstring": null,
|
209 |
-
"docstring_tokens": [],
|
210 |
-
"default": null,
|
211 |
-
"is_optional": null
|
212 |
-
}
|
213 |
-
],
|
214 |
"outlier_params": [],
|
215 |
"others": []
|
216 |
}
|
217 |
}
|
218 |
-
|
219 |
```
|
220 |
### Data Fields
|
221 |
|
|
|
90 |
### Data Instances
|
91 |
```
|
92 |
{
|
93 |
+
"hexsha": "78b961a6673ec1e12f8d95c33ef081f75561a87c",
|
94 |
+
"repo": "AIS-Bonn/sl-cutscenes",
|
95 |
+
"path": "sl_cutscenes/object_models.py",
|
|
|
96 |
"license": [
|
97 |
"MIT"
|
98 |
],
|
99 |
+
"language": "Python",
|
100 |
+
"identifier": "MeshLoader",
|
101 |
+
"original_docstring": "\n Class to load the meshes for the objects in a scene.\n ",
|
102 |
+
"docstring": "Class to load the meshes for the objects in a scene.",
|
|
|
103 |
"docstring_tokens": [
|
104 |
+
"Class",
|
|
|
|
|
|
|
105 |
"to",
|
106 |
+
"load",
|
107 |
+
"the",
|
108 |
+
"meshes",
|
109 |
+
"for",
|
110 |
+
"the",
|
111 |
+
"objects",
|
112 |
+
"in",
|
113 |
+
"a",
|
114 |
+
"scene",
|
115 |
+
"."
|
116 |
],
|
117 |
+
"code": "class MeshLoader:\n \"\"\"\n Class to load the meshes for the objects in a scene.\n \"\"\"\n\n def __init__(self):\n \"\"\"Module initializer\"\"\"\n self.base_dir = CONSTANTS.MESH_BASE_DIR\n self.text_dir = CONSTANTS.TEXT_BASE_DIR\n self.reset()\n\n def reset(self):\n self.loaded_meshes = []\n\n def get_meshes(self):\n \"\"\" \"\"\"\n extract_singular = lambda x: x[0] if len(x) == 1 else x\n return [extract_singular(item) for item in self.loaded_meshes]\n\n def load_meshes(self, obj_info: List[object_info.ObjectInfo], **kwargs):\n \"\"\"\n Loads the meshes whose information is given in parameter 'obj_info.\n Each call of this method APPENDS a list to the loaded_meshes attribute.\n :param obj_info: The object information of the meshes to be loaded.\n :param kwargs: additional mesh modifiers such as scale, specified with a leading 'mod_'\n \"\"\"\n paths = []\n for obj in obj_info:\n path = self.text_dir if obj.name.endswith(\"_floor\") or obj.name.endswith(\"_wall\") else self.base_dir\n paths.append((path / obj.mesh_fp).resolve())\n scales = [obj.scale for obj in obj_info]\n class_ids = [obj.class_id for obj in obj_info]\n mod_scales = kwargs.get(\"mod_scale\", [1.0] * len(scales))\n scales = [s * ms for (s, ms) in zip(scales, mod_scales)]\n flags = [mesh_flags(obj) for obj in obj_info]\n meshes = sl.Mesh.load_threaded(filenames=paths, flags=flags)\n\n # Setup class IDs\n for _, (mesh, scale, class_id) in enumerate(zip(meshes, scales, class_ids)):\n pt = torch.eye(4)\n pt[:3, :3] *= scale\n mesh.pretransform = pt\n mesh.class_index = class_id\n\n info_mesh_tuples = list(zip(obj_info, meshes))\n self.loaded_meshes.append(info_mesh_tuples)",
|
118 |
"code_tokens": [
|
119 |
+
"class",
|
120 |
+
"MeshLoader",
|
121 |
+
":",
|
122 |
+
"def",
|
123 |
+
"__init__",
|
124 |
"(",
|
125 |
+
"self",
|
|
|
|
|
126 |
")",
|
127 |
+
":",
|
128 |
+
"\"\"\"Module initializer\"\"\"",
|
129 |
+
"self",
|
130 |
+
".",
|
131 |
+
"base_dir",
|
132 |
+
"=",
|
133 |
+
"CONSTANTS",
|
134 |
+
".",
|
135 |
+
"MESH_BASE_DIR",
|
136 |
+
"self",
|
137 |
+
".",
|
138 |
+
"text_dir",
|
139 |
+
"=",
|
140 |
+
"CONSTANTS",
|
141 |
+
".",
|
142 |
+
"TEXT_BASE_DIR",
|
143 |
+
"self",
|
144 |
+
".",
|
145 |
+
"reset",
|
146 |
+
"(",
|
147 |
+
")",
|
148 |
+
"def",
|
149 |
+
"reset",
|
150 |
+
"(",
|
151 |
+
"self",
|
152 |
+
")",
|
153 |
+
":",
|
154 |
+
"self",
|
155 |
+
".",
|
156 |
+
"loaded_meshes",
|
157 |
+
"=",
|
158 |
+
"[",
|
159 |
+
"]",
|
160 |
+
"def",
|
161 |
+
"get_meshes",
|
162 |
+
"(",
|
163 |
+
"self",
|
164 |
+
")",
|
165 |
+
":",
|
166 |
+
"\"\"\" \"\"\"",
|
167 |
+
"extract_singular",
|
168 |
+
"=",
|
169 |
+
"lambda",
|
170 |
+
"x",
|
171 |
+
":",
|
172 |
+
"x",
|
173 |
+
"[",
|
174 |
+
"0",
|
175 |
+
"]",
|
176 |
"if",
|
177 |
+
"len",
|
178 |
"(",
|
179 |
+
"x",
|
180 |
+
")",
|
181 |
"==",
|
182 |
"1",
|
183 |
+
"else",
|
184 |
+
"x",
|
185 |
"return",
|
186 |
+
"[",
|
187 |
+
"extract_singular",
|
188 |
"(",
|
189 |
+
"item",
|
190 |
")",
|
191 |
+
"for",
|
192 |
+
"item",
|
193 |
+
"in",
|
194 |
+
"self",
|
195 |
+
".",
|
196 |
+
"loaded_meshes",
|
197 |
+
"]",
|
198 |
+
"def",
|
199 |
+
"load_meshes",
|
200 |
+
"(",
|
201 |
+
"self",
|
202 |
+
",",
|
203 |
+
"obj_info",
|
204 |
+
":",
|
205 |
+
"List",
|
206 |
+
"[",
|
207 |
+
"object_info",
|
208 |
+
".",
|
209 |
+
"ObjectInfo",
|
210 |
+
"]",
|
211 |
+
",",
|
212 |
+
"**",
|
213 |
+
"kwargs",
|
214 |
+
")",
|
215 |
+
":",
|
216 |
+
"\"\"\"\n Loads the meshes whose information is given in parameter 'obj_info.\n Each call of this method APPENDS a list to the loaded_meshes attribute.\n :param obj_info: The object information of the meshes to be loaded.\n :param kwargs: additional mesh modifiers such as scale, specified with a leading 'mod_'\n \"\"\"",
|
217 |
+
"paths",
|
218 |
+
"=",
|
219 |
+
"[",
|
220 |
+
"]",
|
221 |
+
"for",
|
222 |
+
"obj",
|
223 |
+
"in",
|
224 |
+
"obj_info",
|
225 |
+
":",
|
226 |
+
"path",
|
227 |
+
"=",
|
228 |
+
"self",
|
229 |
+
".",
|
230 |
+
"text_dir",
|
231 |
"if",
|
232 |
+
"obj",
|
233 |
+
".",
|
234 |
+
"name",
|
235 |
+
".",
|
236 |
+
"endswith",
|
237 |
"(",
|
238 |
+
"\"_floor\"",
|
|
|
|
|
239 |
")",
|
240 |
+
"or",
|
241 |
+
"obj",
|
242 |
+
".",
|
243 |
+
"name",
|
244 |
+
".",
|
245 |
+
"endswith",
|
246 |
"(",
|
247 |
+
"\"_wall\"",
|
248 |
")",
|
|
|
|
|
249 |
"else",
|
250 |
+
"self",
|
251 |
+
".",
|
252 |
+
"base_dir",
|
253 |
+
"paths",
|
254 |
+
".",
|
255 |
+
"append",
|
256 |
"(",
|
257 |
+
"(",
|
258 |
+
"path",
|
259 |
+
"/",
|
260 |
+
"obj",
|
261 |
+
".",
|
262 |
+
"mesh_fp",
|
263 |
")",
|
264 |
+
".",
|
265 |
+
"resolve",
|
|
|
266 |
"(",
|
|
|
267 |
")",
|
268 |
+
")",
|
269 |
+
"scales",
|
270 |
+
"=",
|
271 |
+
"[",
|
272 |
+
"obj",
|
273 |
+
".",
|
274 |
+
"scale",
|
275 |
+
"for",
|
276 |
+
"obj",
|
277 |
+
"in",
|
278 |
+
"obj_info",
|
279 |
+
"]",
|
280 |
+
"class_ids",
|
281 |
+
"=",
|
282 |
+
"[",
|
283 |
+
"obj",
|
284 |
+
".",
|
285 |
+
"class_id",
|
286 |
+
"for",
|
287 |
+
"obj",
|
288 |
+
"in",
|
289 |
+
"obj_info",
|
290 |
+
"]",
|
291 |
+
"mod_scales",
|
292 |
+
"=",
|
293 |
+
"kwargs",
|
294 |
+
".",
|
295 |
+
"get",
|
296 |
+
"(",
|
297 |
+
"\"mod_scale\"",
|
298 |
+
",",
|
299 |
+
"[",
|
300 |
+
"1.0",
|
301 |
+
"]",
|
302 |
+
"*",
|
303 |
+
"len",
|
304 |
+
"(",
|
305 |
+
"scales",
|
306 |
+
")",
|
307 |
+
")",
|
308 |
+
"scales",
|
309 |
+
"=",
|
310 |
+
"[",
|
311 |
+
"s",
|
312 |
+
"*",
|
313 |
+
"ms",
|
314 |
+
"for",
|
315 |
+
"(",
|
316 |
+
"s",
|
317 |
+
",",
|
318 |
+
"ms",
|
319 |
+
")",
|
320 |
+
"in",
|
321 |
+
"zip",
|
322 |
+
"(",
|
323 |
+
"scales",
|
324 |
+
",",
|
325 |
+
"mod_scales",
|
326 |
+
")",
|
327 |
+
"]",
|
328 |
+
"flags",
|
329 |
+
"=",
|
330 |
+
"[",
|
331 |
+
"mesh_flags",
|
332 |
+
"(",
|
333 |
+
"obj",
|
334 |
+
")",
|
335 |
+
"for",
|
336 |
+
"obj",
|
337 |
+
"in",
|
338 |
+
"obj_info",
|
339 |
+
"]",
|
340 |
+
"meshes",
|
341 |
+
"=",
|
342 |
+
"sl",
|
343 |
+
".",
|
344 |
+
"Mesh",
|
345 |
+
".",
|
346 |
+
"load_threaded",
|
347 |
+
"(",
|
348 |
+
"filenames",
|
349 |
+
"=",
|
350 |
+
"paths",
|
351 |
+
",",
|
352 |
+
"flags",
|
353 |
+
"=",
|
354 |
+
"flags",
|
355 |
+
")",
|
356 |
+
"for",
|
357 |
+
"_",
|
358 |
+
",",
|
359 |
+
"(",
|
360 |
+
"mesh",
|
361 |
+
",",
|
362 |
+
"scale",
|
363 |
+
",",
|
364 |
+
"class_id",
|
365 |
+
")",
|
366 |
+
"in",
|
367 |
+
"enumerate",
|
368 |
+
"(",
|
369 |
+
"zip",
|
370 |
+
"(",
|
371 |
+
"meshes",
|
372 |
+
",",
|
373 |
+
"scales",
|
374 |
+
",",
|
375 |
+
"class_ids",
|
376 |
+
")",
|
377 |
+
")",
|
378 |
+
":",
|
379 |
+
"pt",
|
380 |
+
"=",
|
381 |
+
"torch",
|
382 |
+
".",
|
383 |
+
"eye",
|
384 |
+
"(",
|
385 |
+
"4",
|
386 |
+
")",
|
387 |
+
"pt",
|
388 |
+
"[",
|
389 |
+
":",
|
390 |
+
"3",
|
391 |
+
",",
|
392 |
+
":",
|
393 |
+
"3",
|
394 |
+
"]",
|
395 |
+
"*=",
|
396 |
+
"scale",
|
397 |
+
"mesh",
|
398 |
+
".",
|
399 |
+
"pretransform",
|
400 |
+
"=",
|
401 |
+
"pt",
|
402 |
+
"mesh",
|
403 |
+
".",
|
404 |
+
"class_index",
|
405 |
+
"=",
|
406 |
+
"class_id",
|
407 |
+
"info_mesh_tuples",
|
408 |
+
"=",
|
409 |
+
"list",
|
410 |
+
"(",
|
411 |
+
"zip",
|
412 |
+
"(",
|
413 |
+
"obj_info",
|
414 |
+
",",
|
415 |
+
"meshes",
|
416 |
+
")",
|
417 |
+
")",
|
418 |
+
"self",
|
419 |
+
".",
|
420 |
+
"loaded_meshes",
|
421 |
+
".",
|
422 |
+
"append",
|
423 |
+
"(",
|
424 |
+
"info_mesh_tuples",
|
425 |
+
")"
|
426 |
],
|
427 |
+
"short_docstring": "Class to load the meshes for the objects in a scene.",
|
|
|
428 |
"short_docstring_tokens": [
|
429 |
+
"Class",
|
|
|
|
|
|
|
430 |
"to",
|
431 |
+
"load",
|
432 |
+
"the",
|
433 |
+
"meshes",
|
434 |
+
"for",
|
435 |
+
"the",
|
436 |
+
"objects",
|
437 |
+
"in",
|
438 |
+
"a",
|
439 |
+
"scene",
|
440 |
+
"."
|
441 |
],
|
442 |
+
"comment": [
|
443 |
+
"\"\"\"\n Class to load the meshes for the objects in a scene.\n \"\"\"",
|
444 |
+
"\"\"\"Module initializer\"\"\"",
|
445 |
+
"\"\"\" \"\"\"",
|
446 |
+
"\"\"\"\n Loads the meshes whose information is given in parameter 'obj_info.\n Each call of this method APPENDS a list to the loaded_meshes attribute.\n :param obj_info: The object information of the meshes to be loaded.\n :param kwargs: additional mesh modifiers such as scale, specified with a leading 'mod_'\n \"\"\"",
|
447 |
+
"# Setup class IDs"
|
|
|
|
|
|
|
|
|
448 |
],
|
449 |
+
"parameters": [],
|
450 |
"docstring_params": {
|
451 |
"returns": [],
|
452 |
"raises": [],
|
453 |
+
"params": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
"outlier_params": [],
|
455 |
"others": []
|
456 |
}
|
457 |
}
|
|
|
458 |
```
|
459 |
### Data Fields
|
460 |
|