Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Connect timeout on endpoint URL #36

Closed
GevorgAghekyan opened this issue Sep 3, 2020 · 4 comments
Closed

Exception: Connect timeout on endpoint URL #36

GevorgAghekyan opened this issue Sep 3, 2020 · 4 comments

Comments

@GevorgAghekyan
Copy link

Script
Failure

@GevorgAghekyan
Copy link
Author

Also:
distributed.utils_perf - WARNING - full garbage collections took 10% CPU time recently (threshold: 10%)

@davidbuniat
Copy link
Member

Looks to me in an internet connection issue with uploading large amounts of data. If you share the minimal reproducible code, we will try to replicate it.

@GevorgAghekyan
Copy link
Author

GevorgAghekyan commented Sep 3, 2020

The folder for annotations is here: annotations
The folder for images is here: images

The reproducible script is below:

import os
import cv2
import hub
import psutil
import numpy as np
from hub import Transform
from hub import tensor, dataset

# read file
with open('annot/train.json', 'r') as myfile:
    data=myfile.read()
#     myfile.close()

# parse file
train_annotations = json.loads(data)

train_set_dict = dict()
for annot in train_annotations:
    image_name = annot['image']
    del annot['image']
    train_set_dict[image_name] = annot
    
myfile.close()


# read file
with open('annot/valid.json', 'r') as myfile:
    data=myfile.read()

# parse file
valid_annotations = json.loads(data)

valid_set_dict = dict()
for annot in valid_annotations:
    image_name = annot['image']
    del annot['image']
    valid_set_dict[image_name] = annot
    
myfile.close()
    
# read file
with open('annot/test.json', 'r') as myfile:
    data=myfile.read()

# parse file
test_annotations = json.loads(data)

test_set_dict = dict()
for annot in test_annotations:
    image_name = annot['image']
    del annot['image']
    test_set_dict[image_name] = annot

myfile.close()

# read file
with open('annot/trainval.json', 'r') as myfile:
    data=myfile.read()

# parse file
trainval_annotations = json.loads(data)

trainval_set_dict = dict()
for annot in trainval_annotations:
    image_name = annot['image']
    del annot['image']
    trainval_set_dict[image_name] = annot

myfile.close()

# merging dicts
overall_dict = {**train_set_dict, **test_set_dict, **valid_set_dict, **trainval_set_dict}

directoryName = 'annotated_images'
imageNames = os.listdir(directoryName)

class Convert(Transform):

    def forward(self, elem):
        ds = dict()
        ds['image'] = np.empty(1, object)
        ds['image'][0] = cv2.imread(os.path.join(directoryName, elem))
        ds['annotation'] = np.empty(1, object)
        ds['annotation'][0] = overall_dict[elem]
        return ds

    def meta(self):
        return {'image': {"shape": (1,), "dtype": "object"}, 'annotation': {"shape": (1,), "dtype": "object"}}

hub.init(processes=True, n_workers=psutil.cpu_count(), memory_limit=55e13)

ds = dataset.generate(Convert(), imageNames)

ds.store("gevorg/MPII_Human_Pose_Dataset")`

Note: The upload of the images into the provided "images" folder is still in progress. Will be complete approximately in an hour.

@mynameisvinn
Copy link
Contributor

closed due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants