Skip to content

Commit 913255a

Browse files
committed
reorg of exampels
1 parent 20f5583 commit 913255a

File tree

7 files changed

+6
-104
lines changed

7 files changed

+6
-104
lines changed

README.md

+6-104
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77

88
A repository showcasing examples of using [Hub](https://github.com/activeloopai/Hub)
9-
- [Uploading Dataset Places365](datasets/places365)
10-
- [Training a model using Pytorch Lightning](examples/pytorch-lightning)
11-
- [Augmentation using Albumentations](examples/albumentations)
12-
- [Run Hub on MinIO (local S3)](examples/minio)
9+
- [Uploading Dataset Places365](places365/upload.py)
10+
- [Notebook on uploading Coco](coco/upload_coco.ipynb)
11+
- [Training a model using Pytorch Lightning](pytorch-lightning/mnist.py)
12+
- [Augmentation using Albumentations](albumentations/augment.py)
13+
- [Run Hub on MinIO (local S3)](minio)
14+
- [Computer Vision Transformation pipeline on Cifar](transforming)
1315

1416
### Colab Tutorials
1517

@@ -23,106 +25,6 @@ A repository showcasing examples of using [Hub](https://github.com/activeloopai/
2325
| Creating Time-Series Datasets | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/activeloopai/examples/blob/main/colabs/Creating_Time_Series_Datasets.ipynb) |
2426

2527

26-
27-
## Getting Started with Hub 🚀
28-
29-
30-
### Installation
31-
Hub is written in 100% python and can be quickly installed using pip.
32-
```sh
33-
pip3 install hub
34-
```
35-
36-
37-
### Creating Datasets
38-
39-
A hub dataset can be created in various locations (Storage providers). This is how the paths for each of them would look like:
40-
41-
| Storage provider | Example path |
42-
| ---------------- | ----------------------------- |
43-
| Hub cloud | hub://user_name/dataset_name |
44-
| AWS S3 | s3://bucket_name/dataset_name |
45-
| GCP | gcp://bucket_name/dataset_name|
46-
| Local storage | path to local directory |
47-
| In-memory | mem://dataset_name |
48-
49-
50-
51-
Let's create a dataset in the Hub cloud. Create a new account with Hub from the terminal using `activeloop register` if you haven't already. You will be asked for a user name, email id and passowrd. The user name you enter here will be used in the dataset path.
52-
53-
```sh
54-
$ activeloop register
55-
Enter your details. Your password must be atleast 6 characters long.
56-
Username:
57-
Email:
58-
Password:
59-
```
60-
61-
Initialize an empty dataset in the hub cloud:
62-
63-
```python
64-
import hub
65-
66-
ds = hub.empty("hub://<USERNAME>/test-dataset")
67-
```
68-
69-
Next, create a tensor to hold images in the dataset we just initialized:
70-
71-
```python
72-
images = ds.create_tensor("images", htype="image", sample_compression="jpg")
73-
```
74-
75-
Assuming you have a list of image file paths, lets upload them to the dataset:
76-
77-
```python
78-
image_paths = ...
79-
with ds:
80-
for image_path in image_paths:
81-
image = hub.read(image_path)
82-
ds.images.append(image)
83-
```
84-
85-
Alternatively, you can also upload numpy arrays. Since the `images` tensor was created with `sample_compression="jpg"`, the arrays will be compressed with jpeg compression.
86-
87-
88-
```python
89-
import numpy as np
90-
91-
with ds:
92-
for _ in range(1000): # 1000 random images
93-
radnom_image = np.random.randint(0, 256, (100, 100, 3)) # 100x100 image with 3 channels
94-
ds.images.append(image)
95-
```
96-
97-
98-
99-
### Loading Datasets
100-
101-
102-
You can load the dataset you just created with a single line of code:
103-
104-
```python
105-
import hub
106-
107-
ds = hub.load("hub://<USERNAME>/test-dataset")
108-
```
109-
110-
You can also access other publicly available hub datasets, not just the ones you created. Here is how you would load the [Objectron Bikes Dataset](https://github.com/google-research-datasets/Objectron):
111-
112-
```python
113-
import hub
114-
115-
ds = hub.load('hub://activeloop/objectron_bike_train')
116-
```
117-
118-
To get the first image in the Objectron Bikes dataset in numpy format:
119-
120-
121-
```python
122-
image_arr = ds.image[0].numpy()
123-
```
124-
125-
12628

12729
## Documentation
12830
Getting started guides, examples, tutorials, API reference, and other usage information can be found on our [documentation page](http://docs.activeloop.ai/?utm_source=github&utm_medium=repo&utm_campaign=readme).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)