|
@@ -1,6 +1,6 @@
|
|
|
-# [NA-Birds](http://dl.allaboutbirds.org/nabirds) dataset wrapper
|
|
|
+# CV Datasets Wrapper
|
|
|
|
|
|
-For more deatils to see how to use this library take a look at [nabirds/display.py](nabirds/display.py).
|
|
|
+<!-- For more deatils to see how to use this library take a look at [nabirds/display.py](nabirds/display.py). -->
|
|
|
|
|
|
## Annotation and Image Loading
|
|
|
|
|
@@ -8,7 +8,7 @@ Here is some example code how to load images and use the predefined train-test s
|
|
|
|
|
|
```python
|
|
|
# replace NAB_Annotations with CUB_Annotations to load CUB200-2011 annotations
|
|
|
-from nabirds import NAB_Annotations, Dataset
|
|
|
+from cvdatasets import NAB_Annotations, Dataset
|
|
|
|
|
|
annot = NAB_Annotations("path/to/nab/folder")
|
|
|
|
|
@@ -91,7 +91,7 @@ for im, parts, label in train_data:
|
|
|
```
|
|
|
|
|
|
## Working with Part Annotations
|
|
|
-Both datasets (NAB and CUB) have part annotations. Each annotation has for each of the predefined parts the location of this part and a boolean (`0` or `1`) value whether this part is visible. A [`Dataset`](nabirds/dataset/__init__.py) instance returns besides the image and the class label this information:
|
|
|
+Both datasets (NAB and CUB) have part annotations. Each annotation has for each of the predefined parts the location of this part and a boolean (`0` or `1`) value whether this part is visible. A [`Dataset`](cvdatasets/dataset/__init__.py) instance returns besides the image and the class label this information:
|
|
|
|
|
|
```python
|
|
|
|
|
@@ -116,7 +116,7 @@ print(parts)
|
|
|
|
|
|
### Visible Parts
|
|
|
|
|
|
-In order to filter by only visible parts use the [`visible_locs`](nabirds/dataset/part.py#L46) method. It returns the indices and the x-y positions of the visible parts:
|
|
|
+In order to filter by only visible parts use the [`visible_locs`](cvdatasets/dataset/part.py#L46) method. It returns the indices and the x-y positions of the visible parts:
|
|
|
|
|
|
```python
|
|
|
...
|
|
@@ -141,7 +141,7 @@ In case you don't want to use the ground truth parts, you can generate parts uni
|
|
|
|
|
|
```python
|
|
|
...
|
|
|
-from nabirds.dataset.part import UniformParts
|
|
|
+from cvdatasets.dataset.part import UniformParts
|
|
|
|
|
|
parts = UniformParts(im, ratio=1/3)
|
|
|
idxs, xy = parts.visible_locs()
|
|
@@ -160,7 +160,7 @@ plt.show()
|
|
|
```
|
|
|
|
|
|
### Crop Extraction
|
|
|
-From the locations we can also extract some crops. Same as in [`UniformParts`](nabirds/dataset/part.py#L76) you have to give a ratio with which the crops around the locations are created:
|
|
|
+From the locations we can also extract some crops. Same as in [`UniformParts`](cvdatasets/dataset/part.py#L76) you have to give a ratio with which the crops around the locations are created:
|
|
|
|
|
|
```python
|
|
|
...
|
|
@@ -183,11 +183,11 @@ plt.show()
|
|
|
|
|
|
|
|
|
### Random Crops
|
|
|
-In some cases randomly selected crops are desired. Here you can use the [`utils.random_index`](nabirds/utils/__init__.py#L3) function. As optional argument you can also pass a `rnd` argument, that can be an integer (indicating a random seed) or a `numpy.random.RandomState` instance. Additionally, you can also determine the number of crops that will be selected (default is to select random number of crops).
|
|
|
+In some cases randomly selected crops are desired. Here you can use the [`utils.random_index`](cvdatasets/utils/__init__.py#L3) function. As optional argument you can also pass a `rnd` argument, that can be an integer (indicating a random seed) or a `numpy.random.RandomState` instance. Additionally, you can also determine the number of crops that will be selected (default is to select random number of crops).
|
|
|
|
|
|
```python
|
|
|
...
|
|
|
-from nabirds import utils
|
|
|
+from cvdatasets import utils
|
|
|
import copy
|
|
|
|
|
|
part_crops = parts.visible_crops(im, ratio=0.2)
|
|
@@ -216,7 +216,7 @@ plt.show()
|
|
|
|
|
|
|
|
|
### Revealing of the Parts
|
|
|
-In order to create a single image, that consist of the given parts on their correct location use [`reveal`](nabirds/dataset/part.py#L58) function. It requires again besides the original image and the locations the ratio with which the parts around the locations should be revealed:
|
|
|
+In order to create a single image, that consist of the given parts on their correct location use [`reveal`](cvdatasets/dataset/part.py#L58) function. It requires again besides the original image and the locations the ratio with which the parts around the locations should be revealed:
|
|
|
|
|
|
```python
|
|
|
|