Skip to content

Commit eac43b3

Browse files
authored
Merge pull request #3 from lightly-ai/pre_release_1.0.0_pw
Pre release 1.0.0
2 parents b9f7680 + ecd00b6 commit eac43b3

19 files changed

+22
-79
lines changed

lightly/api/communication.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from lightly.api.utils import getenv
1111
SERVER_LOCATION = getenv('LIGHTLY_SERVER_LOCATION',
12-
'https://api.whattolabel.com')
12+
'https://api.lightly.ai')
1313

1414

1515
def _post_request(dst_url, data=None, json=None,

lightly/cli/config/config.yaml

+1-8
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ embeddings: '' # Path to csv file which holds embeddings.
77
checkpoint: '' # Path to a model checkpoint. If left empty, a pre-trained model
88
# will be used.
99

10-
### deprecated!
11-
# The following arguments are deprecated and will be removed
12-
# in the next version.
13-
from_folder: '' # Path to input directory which holds images (replaced by input_dir).
14-
path_to_folder: '' # Path to input directory which holds images (replaced by input_dir).
15-
path_to_embeddings: '' # Path to csv file which holds embeddings (replaced by embeddings).
16-
1710
### platform
1811
# The following arguments are required for requests to the
1912
# Lightly platform.
2013
token: '' # User access token to the platform.
2114
dataset_id: '' # Identifier of the dataset on the platform
22-
upload: 'thumbnails' # Whether to upload full images, thumbnails only, or metadata only.
15+
upload: 'full' # Whether to upload full images, thumbnails only, or metadata only.
2316
# Must be one of ['full', 'thumbnails', 'none']
2417
embedding_name: 'default' # Name of the embedding to be used on the platform.
2518
emb_upload_bsz: 32 # Number of embeddings which are uploaded in a single batch.

lightly/cli/download_cli.py

+5-16
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,19 @@
2020

2121

2222
def _download_cli(cfg, is_cli_call=True):
23-
'''Download all samples in a given tag.
24-
If input_dir and output_dir are specified, a copy of all images
25-
in the tag will be stored in the output directory.
26-
27-
Args:
28-
cfg['input_dir']: (str, optional)
29-
Path to folder which holds all images from the dataset
30-
cfg['output_dir']: (str, optional)
31-
Path to folder where the copied images will be stored
32-
cfg['tag_name']: (str) Name of the requested tag
33-
cfg['dataset_id']: (str) Dataset identifier on the platform
34-
cfg['token']: (str) Token which grants access to the platform
35-
36-
'''
3723

3824
tag_name = cfg['tag_name']
3925
dataset_id = cfg['dataset_id']
4026
token = cfg['token']
4127

4228
if not tag_name:
4329
print('Please specify a tag name')
44-
print('For help, try: lightly-upload --help')
30+
print('For help, try: lightly-download --help')
4531
return
4632

4733
if not token or not dataset_id:
4834
print('Please specify your access token and dataset id')
49-
print('For help, try: lightly-upload --help')
35+
print('For help, try: lightly-download --help')
5036
return
5137

5238
# get all samples in the queried tag
@@ -62,6 +48,9 @@ def _download_cli(cfg, is_cli_call=True):
6248
with open(cfg['tag_name'] + '.txt', 'w') as f:
6349
for item in samples:
6450
f.write("%s\n" % item)
51+
msg = 'The list of files in tag {} is stored at: '.format(cfg['tag_name'])
52+
msg += os.path.join(os.getcwd(), cfg['tag_name'] + '.txt')
53+
print(msg)
6554

6655
if cfg['input_dir'] and cfg['output_dir']:
6756
# "name.jpg" -> "/name.jpg" to prevent bugs like this:

lightly/cli/embed_cli.py

-16
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,6 @@
2626

2727

2828
def _embed_cli(cfg, is_cli_call=True):
29-
"""Use the trained self-supervised model to embed samples from your dataset.
30-
31-
Args:
32-
cfg[data]: (str) Name of the dataset
33-
cfg[root]: (str) Directory where the dataset should be stored
34-
cfg[checkpoint]: (str) Path to the lightning checkpoint
35-
cfg[download]: (bool) Whether to download the dataset
36-
cfg[input_dir]: (str) If specified, the dataset is loaded \
37-
from the folder
38-
39-
Returns:
40-
embeddings: (np.ndarray) A d-dimensional embedding \
41-
for each data sample
42-
labels: (np.ndarray) Data labels, 0 if there are no labels
43-
filenames: (List[str]) File name of each data sample
44-
"""
4529

4630
data = cfg['data']
4731
checkpoint = cfg['checkpoint']

lightly/cli/train_cli.py

-14
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@
2626

2727

2828
def _train_cli(cfg, is_cli_call=True):
29-
"""Train a self-supervised model on the image dataset of your choice.
30-
31-
Args:
32-
cfg[data]: (str)
33-
Name of the dataset (to download use cifar10 or cifar100)
34-
cfg[root]: (str) Directory where the dataset should be stored
35-
cfg[download]: (bool) Whether to download the dataset
36-
cfg[input_dir]: (str)
37-
If specified, the dataset is loaded from the folder
38-
39-
Returns:
40-
checkpoint: (str) Path to checkpoint of the best model during training
41-
42-
"""
4329

4430
data = cfg['data']
4531
download = cfg['download']

lightly/cli/upload_cli.py

-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@
1616

1717

1818
def _upload_cli(cfg, is_cli_call=True):
19-
'''Upload your image dataset and/or embeddings to the Lightly platform.
20-
21-
Args:
22-
cfg['input_dir']: (str) Path to folder which holds images to upload
23-
cfg['embeddings']: (str) Path to csv file which holds embeddings to upload
24-
cfg['dataset_id']: (str) Dataset identifier on the platform
25-
cfg['token']: (str) Token which grants acces to the platform
26-
27-
'''
2819

2920
input_dir = cfg['input_dir']
3021
if input_dir and is_cli_call:

tests/api/test_CreateInitialTag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setup(self, psuccess=1.):
2121

2222
# set up url
2323
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
24-
b'https://api.whattolabel.com').decode()
24+
b'https://api.lightly.ai').decode()
2525
# route
2626
self.dst_url += f'/users/datasets/{self.dataset_id}/tags'
2727

tests/api/test_Get.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setup(self, psuccess=1.):
1818

1919
# set up url
2020
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
21-
b'https://api.whattolabel.com').decode()
21+
b'https://api.lightly.ai').decode()
2222
# route
2323
self.dst_url += '/sample/route/to/get'
2424
# query

tests/api/test_GetLatestVersion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setup(self, psuccess=1.):
2020

2121
# set up url
2222
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
23-
b'https://api.whattolabel.com').decode()
23+
b'https://api.lightly.ai').decode()
2424
# route
2525
self.dst_url += '/pip/version'
2626
self.version = '0.0.0'

tests/api/test_GetPresignedURL.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setup(self, n_data=1000, psuccess=1.):
2222

2323
# set up url
2424
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
25-
b'https://api.whattolabel.com').decode()
25+
b'https://api.lightly.ai').decode()
2626
# route
2727
self.dst_url += f'/users/datasets/{self.dataset_id}'
2828
self.dst_url += f'/samples/{self.sample_id}/writeurl'

tests/api/test_GetSamples.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ def setup(self, mode='tag_exists', psuccess=1.):
2121
self.token = '123'
2222

2323
self.tag_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
24-
b'https://api.whattolabel.com').decode()
24+
b'https://api.lightly.ai').decode()
2525
self.tag_url += f'/users/datasets/{self.dataset_id}/tags/'
2626
self.tags = [
2727
{'name': 'initial-tag', '_id': '123'},
2828
{'name': 'test-tag', '_id': '456'},
2929
]
3030

3131
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
32-
b'https://api.whattolabel.com').decode()
32+
b'https://api.lightly.ai').decode()
3333
self.dst_url += f'/users/datasets/{self.dataset_id}/tags/123/download'
3434
self.samples = 'sample_1.jpg\nsample_2.jpg'
3535

tests/api/test_GetTags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def setup(self, psuccess=1.):
2525

2626
# set up url
2727
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
28-
b'https://api.whattolabel.com').decode()
28+
b'https://api.lightly.ai').decode()
2929
# route
3030
self.dst_url += f'/users/datasets/{self.dataset_id}/tags'
3131
# query

tests/api/test_Post.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setup(self, psuccess=1.):
1818

1919
# set up url
2020
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
21-
b'https://api.whattolabel.com').decode()
21+
b'https://api.lightly.ai').decode()
2222
# route
2323
self.dst_url += '/sample/route/to/post'
2424

tests/api/test_Put.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setup(self, psuccess=1.):
1818

1919
# set up url
2020
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
21-
b'https://api.whattolabel.com').decode()
21+
b'https://api.lightly.ai').decode()
2222
# route
2323
self.dst_url += '/sample/route/to/put'
2424

tests/api/test_UploadEmbedding.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setup(self, psuccess=1.):
2828
}
2929

3030
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
31-
b'https://api.whattolabel.com').decode()
31+
b'https://api.lightly.ai').decode()
3232
self.dst_url += f'/users/datasets/{self.dataset_id}/embeddings'
3333

3434
def callback_1(self, request):

tests/api/test_UploadEmbeddings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setup(self, n_data=1000):
2121

2222
# set up url
2323
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
24-
b'https://api.whattolabel.com').decode()
24+
b'https://api.lightly.ai').decode()
2525
self.emb_url = f'{self.dst_url}/users/datasets/{self.dataset_id}/embeddings'
2626
self.tag_url = f'{self.dst_url}/users/datasets/{self.dataset_id}/tags/?token={self.token}'
2727

tests/api/test_UploadImages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setup(self, n_data=1000):
1818
self.dataset_id = 'XYZ'
1919
self.token = 'secret'
2020
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
21-
b'https://api.whattolabel.com').decode()
21+
b'https://api.lightly.ai').decode()
2222

2323
self.gettag_url = f'{self.dst_url}/users/datasets/{self.dataset_id}/tags/?token={self.token}'
2424
self.sample_url = f'{self.dst_url}/users/datasets/{self.dataset_id}/samples/'

tests/api/test_UploadSample.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setup(self, psuccess=1.):
2828
}
2929

3030
self.dst_url = os.getenvb(b'LIGHTLY_SERVER_LOCATION',
31-
b'https://api.whattolabel.com').decode()
31+
b'https://api.lightly.ai').decode()
3232
self.dst_url += f'/users/datasets/{self.dataset_id}/samples/'
3333

3434
def callback(self, request):

tox.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ whitelist_externals = make
1010
pip
1111

1212
passenv = *
13-
setenv = LIGHTLY_SERVER_LOCATION = https://api-dev.whattolabel.com
13+
setenv = LIGHTLY_SERVER_LOCATION = https://api-dev.lightly.ai
1414

1515
commands =
1616
pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html
@@ -25,7 +25,7 @@ whitelist_externals = make
2525
pip
2626

2727
passenv = *
28-
setenv = LIGHTLY_SERVER_LOCATION = https://api-dev.whattolabel.com
28+
setenv = LIGHTLY_SERVER_LOCATION = https://api-dev.lightly.ai
2929
CUDA_VISIBLE_DEVICES = -1
3030

3131
commands =

0 commit comments

Comments
 (0)