Skip to content

Commit

Permalink
Update readme with some directions
Browse files Browse the repository at this point in the history
  • Loading branch information
NTL-Remi committed Nov 12, 2019
1 parent 7238649 commit dba3ddc
Showing 1 changed file with 68 additions and 2 deletions.
70 changes: 68 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,76 @@

**WIP - Version 0**

This is a Python package for visualisation and loading of Baidu's ApolloScape dataset for vehicle vision tasks.
This is a Python package for visualisation and loading of Baidu's ApolloScape data-set for vehicle vision tasks.

Currently it is only focused on the overlapping [__Lane segmentation__][lane_segmentation] and [__Scene parsing__][scene_parsing] datasets.
Currently it is only focused on the overlapping [__Lane segmentation__][lane_segmentation] and [__Scene parsing__][scene_parsing] data-sets.

## temporary usage

Currently this project is still a bit messy. I plan on cleaning it and
improving the UI (probably inducing some heavy changes) when I will have some
time.
Here is some code if you want to use it in its current state:

```python
import apolloscope
from apolloscope.ls_sp.register import Register, SequenceId, TypeId
```
Specify the paths to the data-set:
```python
sp_path = PATH_TO_YOUR_SCENE_PARSING_FOLDER
ls_path = PATH_TO_YOUR_LANE_SEGMENTATION_FOLDER

apolloscope.root_folder.scene_parsing(sp_path)
apolloscope.root_folder.lane_segmentation(ls_path)
```
The expected folder architecture is the one used in ApolloScape archive files.
Some archives seem to have been zipped differently than others and will not
recreate the top-most folder (the one that has the same name as the archive),
you will have to create it yourself (this is for example the case for the scene
parsing `road02_seg_depth.tar.gz` file).

This will parse the file paths in the specified folders and classifying
them by image type and sequence in a multi-indexed data-frame (see it like a 2D
array in which we are going to slice depending on the data we want):
```python
register = Register()
```
Say that we want to iterate at the same time on the colour data, the semantic
segmentation and the depth maps. We define the three data types:
```python
image_type = TypeId(dataset="SP",
section="seg",
subsection="ColorImage",
file_type="jpg")
depth_type = TypeId("SP", "seg_depth", "Depth", "png")
seg_type = TypeId("SP", "seg", "Label", "bin.png")
```
Suppose that we want to iterate over the frames captured on road 2,
sequence 22, camera 5. We define the sequence:
```python
test_sequence = SequenceId(road=2, record=22, camera=5)
```
In both data types and sequences definition, all parameters are optional,
allowing to select larger parts of the data-set. Defining
```python
test_sequence = SequenceId(road=2, camera=5)
```
will take the data of all records on road 2 filmed by camera 5.

To actually select the data from `register`, we do:
```python
filtered_register = register.types([file_type, depth_type, seg_type])
filtered_register = filtered_register.sequences([test_sequence])
```
We can then get the Pytorch dataset:
```python
dataset = apolloscope.ls_sp.pytorch.Dataset(filtered_register)
```
and use it in a pytorch dataloader in a classical way.
In the current case, each element would be a tuple of three images
corresponding to the three data types we defined, at a same time-stamp.
Triplets with missing data would be dropped.

[lane_segmentation]: http://apolloscape.auto/lane_segmentation.html
[scene_parsing]: http://apolloscape.auto/scene.html
Expand Down

0 comments on commit dba3ddc

Please sign in to comment.