From d5d5a7fb2d0acca59705b3be8e2e7fe0bf36666a Mon Sep 17 00:00:00 2001 From: Ars Vladimirov Date: Mon, 22 May 2023 12:40:55 +0600 Subject: [PATCH 1/4] init --- .gitignore | 4 +++- .vscode/launch.json | 2 +- requirements.txt | 9 +++++++-- supervisely/train/debug.env | 18 +++++++++--------- train.py | 2 ++ utils/datasets.py | 1 + utils/loss.py | 1 + 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 5c93fc12348f..d49327f5e32d 100755 --- a/.gitignore +++ b/.gitignore @@ -249,4 +249,6 @@ crashlytics.properties crashlytics-build.properties fabric.properties -supervisely_lib \ No newline at end of file +supervisely_lib + +app_debug_data/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 7cb46d0c698d..5a677e2427a7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Debug", "type": "python", "request": "launch", - "program": "${workspaceFolder}/supervisely/serve/src/main.py", + "program": "${workspaceFolder}/supervisely/train/src/sly_train.py", "console": "integratedTerminal", "justMyCode": false, "env": { diff --git a/requirements.txt b/requirements.txt index 5c9d3f83ccad..2bc6cb253be3 100755 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,11 @@ supervisely==6.72.12 opencv-python-headless==4.5.5.62 opencv-python==4.5.5.62 +--extra-index-url https://download.pytorch.org/whl/cu113 +# torch==2.0.0 +torch==1.11.0 +torchvision==0.12.0 + # base ---------------------------------------- PyYAML==5.4.1 tensorboard==2.4.1 @@ -15,8 +20,8 @@ seaborn==0.11.1 coremltools==4.1 onnx>=1.8.0 onnxruntime==1.8.0 -# scikit-learn==1.1.1 # for coreml quantization -numpy==1.19.0 +scikit-learn==1.1.1 # for coreml quantization +numpy==1.21.2 # extras -------------------------------------- thop==0.0.31-2005241907 # FLOPS computation pycocotools==2.0.2 # COCO mAP diff --git a/supervisely/train/debug.env b/supervisely/train/debug.env index f32ca184fde1..22f208a3c1b4 100644 --- a/supervisely/train/debug.env +++ b/supervisely/train/debug.env @@ -1,16 +1,16 @@ PYTHONUNBUFFERED=1 -DEBUG_APP_DIR="/app_debug_data" -DEBUG_CACHE_DIR="/app_cache" +DEBUG_APP_DIR="./app_debug_data" +DEBUG_CACHE_DIR="./app_cache" LOG_LEVEL="debug" -TASK_ID=4326 +TASK_ID=34361 -context.teamId=229 -context.workspaceId=287 +context.teamId=449 +context.workspaceId=691 #modal.state.slyProjectId=3529 # lemons-annotated -modal.state.slyProjectId=3643 # lemons with ready train/val tags +modal.state.slyProjectId=21837 # lemons with ready train/val tags -SERVER_ADDRESS="put your value here" -API_TOKEN="put your value here" -AGENT_TOKEN="put your value here" \ No newline at end of file +SERVER_ADDRESS="https://dev.supervise.ly/" +API_TOKEN="l5ZuzVYNKY7MPt5vfk0tlynPe2yU2ReD07xxyONSGMotAQCokZJ4J93LK5ALDHt56eFGGuBzXd6TefC4MVOWcuMOsyG0fwTsbaKYxRwtiyUUdB6jRyP4oFekMS1ujDvF" +AGENT_TOKEN="MDOypRHIS1lqCskratTKyNMxnd8EqlcW" \ No newline at end of file diff --git a/train.py b/train.py index eb585d3c949b..715336362183 100644 --- a/train.py +++ b/train.py @@ -67,6 +67,8 @@ def train(hyp, opt, device, tb_writer=None): + + device = torch.device("cpu") train_batches_uploaded = False logger.info("hyperparameters", extra=hyp) diff --git a/utils/datasets.py b/utils/datasets.py index 3fcdddd7c013..dc220d21298f 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -455,6 +455,7 @@ def cache_labels(self, path=Path('./labels.cache'), prefix=''): # Cache dataset labels, check images and read shapes x = {} # dict nm, nf, ne, nc = 0, 0, 0, 0 # number missing, found, empty, duplicate + # possible bug pbar = tqdm(zip(self.img_files, self.label_files), desc='Scanning images', total=len(self.img_files)) for i, (im_file, lb_file) in enumerate(pbar): try: diff --git a/utils/loss.py b/utils/loss.py index 9e78df17fdf3..0aac3383f6fd 100644 --- a/utils/loss.py +++ b/utils/loss.py @@ -161,6 +161,7 @@ def __call__(self, p, targets): # predictions, targets, model return loss * bs, torch.cat((lbox, lobj, lcls, loss)).detach() def build_targets(self, p, targets): + # targets = targets.float() # Build targets for compute_loss(), input targets(image,class,x,y,w,h) na, nt = self.na, targets.shape[0] # number of anchors, targets tcls, tbox, indices, anch = [], [], [], [] From dd26379eda77e4765779ef74def8f8fd99fd653c Mon Sep 17 00:00:00 2001 From: Ars Vladimirov Date: Mon, 22 May 2023 12:43:12 +0600 Subject: [PATCH 2/4] fix: device = torch.device("cpu") --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 715336362183..dda801f925a1 100644 --- a/train.py +++ b/train.py @@ -68,7 +68,7 @@ def train(hyp, opt, device, tb_writer=None): - device = torch.device("cpu") + # device = torch.device("cpu") train_batches_uploaded = False logger.info("hyperparameters", extra=hyp) From 39149dcc869139fcc714afecabbed9c0ea09b1fe Mon Sep 17 00:00:00 2001 From: Ars Vladimirov Date: Mon, 22 May 2023 13:11:12 +0600 Subject: [PATCH 3/4] debug env --- supervisely/train/debug.env | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/supervisely/train/debug.env b/supervisely/train/debug.env index 22f208a3c1b4..f32ca184fde1 100644 --- a/supervisely/train/debug.env +++ b/supervisely/train/debug.env @@ -1,16 +1,16 @@ PYTHONUNBUFFERED=1 -DEBUG_APP_DIR="./app_debug_data" -DEBUG_CACHE_DIR="./app_cache" +DEBUG_APP_DIR="/app_debug_data" +DEBUG_CACHE_DIR="/app_cache" LOG_LEVEL="debug" -TASK_ID=34361 +TASK_ID=4326 -context.teamId=449 -context.workspaceId=691 +context.teamId=229 +context.workspaceId=287 #modal.state.slyProjectId=3529 # lemons-annotated -modal.state.slyProjectId=21837 # lemons with ready train/val tags +modal.state.slyProjectId=3643 # lemons with ready train/val tags -SERVER_ADDRESS="https://dev.supervise.ly/" -API_TOKEN="l5ZuzVYNKY7MPt5vfk0tlynPe2yU2ReD07xxyONSGMotAQCokZJ4J93LK5ALDHt56eFGGuBzXd6TefC4MVOWcuMOsyG0fwTsbaKYxRwtiyUUdB6jRyP4oFekMS1ujDvF" -AGENT_TOKEN="MDOypRHIS1lqCskratTKyNMxnd8EqlcW" \ No newline at end of file +SERVER_ADDRESS="put your value here" +API_TOKEN="put your value here" +AGENT_TOKEN="put your value here" \ No newline at end of file From c260377fcd990fbc7b4df391aa26b757b6105de6 Mon Sep 17 00:00:00 2001 From: Ars Vladimirov Date: Mon, 22 May 2023 13:13:18 +0600 Subject: [PATCH 4/4] other reverts --- requirements.txt | 1 - train.py | 1 - utils/datasets.py | 1 - utils/loss.py | 1 - 4 files changed, 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2bc6cb253be3..4d365d73fa41 100755 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ opencv-python-headless==4.5.5.62 opencv-python==4.5.5.62 --extra-index-url https://download.pytorch.org/whl/cu113 -# torch==2.0.0 torch==1.11.0 torchvision==0.12.0 diff --git a/train.py b/train.py index dda801f925a1..a46c8bf16188 100644 --- a/train.py +++ b/train.py @@ -68,7 +68,6 @@ def train(hyp, opt, device, tb_writer=None): - # device = torch.device("cpu") train_batches_uploaded = False logger.info("hyperparameters", extra=hyp) diff --git a/utils/datasets.py b/utils/datasets.py index dc220d21298f..3fcdddd7c013 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -455,7 +455,6 @@ def cache_labels(self, path=Path('./labels.cache'), prefix=''): # Cache dataset labels, check images and read shapes x = {} # dict nm, nf, ne, nc = 0, 0, 0, 0 # number missing, found, empty, duplicate - # possible bug pbar = tqdm(zip(self.img_files, self.label_files), desc='Scanning images', total=len(self.img_files)) for i, (im_file, lb_file) in enumerate(pbar): try: diff --git a/utils/loss.py b/utils/loss.py index 0aac3383f6fd..9e78df17fdf3 100644 --- a/utils/loss.py +++ b/utils/loss.py @@ -161,7 +161,6 @@ def __call__(self, p, targets): # predictions, targets, model return loss * bs, torch.cat((lbox, lobj, lcls, loss)).detach() def build_targets(self, p, targets): - # targets = targets.float() # Build targets for compute_loss(), input targets(image,class,x,y,w,h) na, nt = self.na, targets.shape[0] # number of anchors, targets tcls, tbox, indices, anch = [], [], [], []