Skip to content

Commit

Permalink
Merge pull request #573 from weecology/getting_started2
Browse files Browse the repository at this point in the history
new clean PR for #570
  • Loading branch information
ethanwhite authored Dec 11, 2023
2 parents 7ab9f06 + a91a885 commit e79ea2a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ For quick annotations of a few images, we recommend using QGIS or ArcGIS. Either

![QGISannotation](../www/QGIS_annotation.png)

### Label-studio

For longer term projects, we recommend [label-studio](https://labelstud.io/) as an annotation platform. It has many useful features and is easy to set up.

![QGISannotation](../www/label_studio.png)

## Do I need annotate all objects in my image?
Yes! Object detection models use the non-annotated areas of an image as negative data. We know that it can be exceptionally hard to annotate all trees in an image, or determine the classes of all birds in an image. However, if you have objects in the image that are not annotated, the model is learning *to ignore* those portion of the image. This can severely affect model performance.

Expand Down Expand Up @@ -84,3 +90,6 @@ for path in files:
shp.to_file("{}/{}.shp".format(PATH_TO_DIR,basename))
```

## Fast iterations are the key to annotation success

Many projects have a linear concept of annotations with all the annotations collected before model testing. This is often a mistake. Especially in multi-class scenerios, start with a small number of annotations and allow the model to decide which images are most needed. This can be done in an automated way, or simply by looking at confusion matrices and predicted images. Imagine model developement as a pipeline, the more times you can iterate, the more rapidly your model will improve. For an example in airborne wildlife remote sensing, see the excellent paper by [B. Kellenberger et al. 2019](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=8807383&casa_token=ZCCfJk3Fy-IAAAAA:UyZyftM25on1ZUijB1o4gBUWw8JBD5lmVkAvzZqL7PlQTvQMzOIK2n9A73swGUpYZYhARUbw&tag=1).
7 changes: 5 additions & 2 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model.use_release()
img = model.predict_image(path="/Users/benweinstein/Documents/NeonTreeEvaluation/evaluation/RGB/TEAK_049_2019.tif",return_plot=True)
#predict_image returns plot in BlueGreenRed (opencv style), but matplotlib likes RedGreenBlue, switch the channel order.
#predict_image returns plot in BlueGreenRed (opencv style), but matplotlib likes RedGreenBlue, switch the channel order. Many functions in deepforest will automatically perform this flip for you and give a warning.
plt.imshow(img[:,:,::-1])
```

Expand All @@ -22,7 +22,6 @@ plt.imshow(img[:,:,::-1])

<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/f80ed6e3c7bd48d4a20ae32167af3d8c" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>


For single images, ```predict_image``` can read an image from memory or file and return predicted tree bounding boxes.

### Sample data
Expand Down Expand Up @@ -64,6 +63,10 @@ Let's show an example with a small image. For larger images, patch_size should b
raster_path = get_data("OSBS_029.tif")
# Window size of 300px with an overlap of 25% among windows for this small tile.
predicted_raster = model.predict_tile(raster_path, return_plot = True, patch_size=300,patch_overlap=0.25)

# View boxes overlayed when return_plot=True, when False, boxes are returned.
plt.imshow(predicted_raster)
plt.show()
```

** Please note the predict tile function is sensitive to patch_size, especially when using the prebuilt model on new data**
Expand Down
Binary file added www/label_studio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e79ea2a

Please sign in to comment.