You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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):
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
-
126
28
127
29
## Documentation
128
30
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).
0 commit comments