Skip to content

Commit

Permalink
Cleanup docs on reading shape files to avoid user confusion (#783)
Browse files Browse the repository at this point in the history
* Have docs on reading shape files show a standard path

The docs showed reading a file from a tmpdir using the previous
generation of format strings. This is confusing to users (see #781).

Fixes #781

* Remove local shell command; just show csv contents

OS specific shell commands with local path information can be confusing
to users. This removes that command the just shows the output (the
structure of the csv file) which is all the user needs to understand
the behavior of the documented functions.
  • Loading branch information
ethanwhite committed Sep 16, 2024
1 parent 5087c78 commit a17411e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/getting_started/Reading_and_Writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ DeepForest was originally designed for bounding box annotations. As of DeepFores
#### CSV

Here the annotations are in plain csv files, with coordinates relative to image origin.

```
(DeepForest) (base) benweinstein@Bens-MacBook-Pro data % cat OSBS_029.csv
image_path,xmin,ymin,xmax,ymax,label
OSBS_029.tif,203,67,227,90,Tree
OSBS_029.tif,256,99,288,140,Tree
Expand All @@ -25,6 +25,7 @@ OSBS_029.tif,365,21,400,70,Tree
OSBS_029.tif,278,1,312,37,Tree
OSBS_029.tif,364,204,400,246,Tree
```

```
filename = get_data("OSBS_029.csv")
utilities.read_file(filename)
Expand Down Expand Up @@ -52,7 +53,7 @@ Name: 0, dtype: object
These coordinates are made relative to the image origin when the file is read.

```
shp = utilities.read_file(input="{}/test_read_file_boxes_projected.shp".format(tmpdir))
shp = utilities.read_file(input="/path/to/boxes_shapefile.shp")
shp.head()
label image_path geometry
0 Tree OSBS_029.tif POLYGON ((105.000 214.000, 95.000 214.000, 95....
Expand All @@ -71,7 +72,7 @@ x,y,label

### Shapefile
```
annotations = utilities.read_file(input="{}/test_read_file_points_projected.shp".format(tmpdir))
shp = utilities.read_file(input="/path/to/points_shapefile.shp")
annotations.head()
label image_path geometry
0 Tree OSBS_029.tif POINT (100.000 209.000)
Expand All @@ -90,8 +91,9 @@ Polygons are expressed well-known-text format. Learn more about (wkt)[https://en
```

## Shapefile

```
annotations = utilities.read_file(input="{}/test_read_file_polygons_unprojected.shp".format(tmpdir))
shp = utilities.read_file(input="/path/to/polygons_shapefile.shp")
annotations.head()
label image_path geometry
0 Tree OSBS_029.png POLYGON ((0.00000 0.00000, 0.00000 2.00000, 1....
Expand Down

0 comments on commit a17411e

Please sign in to comment.