Skip to content

Commit

Permalink
Merge pull request #32 from saaresearch/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aimspot authored Feb 14, 2024
2 parents 61841ba + a0647af commit 3cf90f3
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 362 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ml-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
pip install -r requirements.txt
- name: Download dataset
run: |
cd user_datasets/yolo
mkdir aeral
cd aeral
curl -L "https://public.roboflow.com/ds/et6MNsOwMJ?key=GMSDIzpYnW" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip
cd user_datasets
git clone https://github.com/AIRI-Institute/WaRP
mkdir WaRP/Warp-D/valid
cp -r WaRP/Warp-D/test/* WaRP/Warp-D/valid/
- name: Ml predictions
run: python ODRS/ml_utils/ml_model_optimizer.py
8 changes: 4 additions & 4 deletions .github/workflows/model-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
pip install -r requirements.txt
- name: Download dataset
run: |
cd user_datasets/yolo
mkdir aeral
cd aeral
curl -L "https://public.roboflow.com/ds/et6MNsOwMJ?key=GMSDIzpYnW" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip
cd user_datasets
git clone https://github.com/AIRI-Institute/WaRP
mkdir WaRP/Warp-D/valid
cp -r WaRP/Warp-D/test/* WaRP/Warp-D/valid/
- name: AI training
run: |
python ODRS/train_utils/custom_train_all.py
2 changes: 1 addition & 1 deletion .github/workflows/pep8-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
pip install flake8
- name: Run PEP8 test
run: |
flake8 --max-line-length=130 --exclude=ODRS/train_utils/train_model/models/*,ODRS/ml_utils/*,ODRS/train_utils/custom_train_all.py,ODRS/train_utils/train_model/scripts/yolov7_train.py,tests/*,docs/* .
flake8 --max-line-length=130 --exclude=ODRS/train_utils/train_model/models/*,ODRS/ml_utils/*,ODRS/train_utils/custom_train_all.py,ODRS/train_utils/train_model/scripts/yolov7_train.py,tests/*,docs/*,ODRS/utils/dataset_info.py .
8 changes: 4 additions & 4 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
pip install -r requirements.txt
- name: Download dataset
run: |
cd user_datasets/yolo
mkdir aeral
cd aeral
curl -L "https://public.roboflow.com/ds/et6MNsOwMJ?key=GMSDIzpYnW" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip
cd user_datasets
git clone https://github.com/AIRI-Institute/WaRP
mkdir WaRP/Warp-D/valid
cp -r WaRP/Warp-D/test/* WaRP/Warp-D/valid/
- name: Test
run: |
python tests/unit_test.py
160 changes: 0 additions & 160 deletions ODRS/data_utils/augmentation/aug_bbox.py

This file was deleted.

96 changes: 0 additions & 96 deletions ODRS/data_utils/augmentation/aug_image.py

This file was deleted.

2 changes: 1 addition & 1 deletion ODRS/data_utils/create_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def delete_cache(data_path):
if file.endswith(tuple(extensions_to_delete)):
os.remove(os.path.join(root, file))


def createRunDirectory(model):
current_file_path = Path(__file__).resolve()

Expand All @@ -36,7 +37,6 @@ def create_config_data(train_path, val_path, classname_file, config_path, arch,
current_file_path = Path(__file__).resolve()

runs_path = createRunDirectory(model)

class_file_path = Path(current_file_path.parents[2]) / classname_file

config_path = runs_path / config_path
Expand Down
4 changes: 1 addition & 3 deletions ODRS/data_utils/prepare_ssd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import json
import glob
from PIL import Image
import xml.etree.ElementTree as ET
from tqdm import tqdm
from pathlib import Path
Expand Down Expand Up @@ -92,4 +90,4 @@ def create_ssd_json(path_folder, txt_path):
except Exception as e:
print(e)

save_as_json(Path(os.path.dirname(path_folder)) / f'{path_folder.name}.json', dataset)
save_as_json(Path(os.path.dirname(path_folder)) / f'{path_folder.name}.json', dataset)
4 changes: 1 addition & 3 deletions ODRS/data_utils/resize_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from PIL import Image


def resize_images_and_annotations(data_path, img_size):
if isinstance(img_size, int):
width = height = img_size
Expand Down Expand Up @@ -55,6 +56,3 @@ def resize_images_and_annotations(data_path, img_size):
file.write(f"{parts[0]} {x_center} {y_center} {box_width} {box_height}\n")

img.save(image_path)


# resize_images_and_annotations('/media/space/ssd_1_tb_evo_sumsung/Work/Warp-D', (640, 480))
14 changes: 7 additions & 7 deletions ODRS/data_utils/split_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from loguru import logger
from pathlib import Path


def sorted_files(image_files, label_files):
new_label_files = list()
new_image_files = list()
Expand All @@ -27,20 +28,19 @@ def split_data(datapath, split_train_value, split_valid_value):
test_path = os.path.join(datapath, 'test')
val_path = os.path.join(datapath, 'valid')

if os.path.exists(train_path) and (os.path.exists(val_path)
or os.path.exists(os.path.join(datapath, 'val'))):
if os.path.exists(train_path) and (os.path.exists(val_path) or
os.path.exists(os.path.join(datapath, 'val'))):
logger.info("Dataset is ready")
return train_path, val_path if os.path.exists(val_path) else os.path.join(datapath, 'val')
if os.path.exists(train_path) and not (os.path.exists(val_path)
or os.path.exists(os.path.join(datapath, 'val'))):
if os.path.exists(train_path) and not (os.path.exists(val_path) or
os.path.exists(os.path.join(datapath, 'val'))):
logger.error("Dataset has no validation sample")
sys.exit()
if not os.path.exists(train_path) and (os.path.exists(val_path)
or os.path.exists(os.path.join(datapath, 'val'))):
if not os.path.exists(train_path) and (os.path.exists(val_path) or
os.path.exists(os.path.join(datapath, 'val'))):
logger.error("Dataset has no training sample")
sys.exit()


images_path = os.path.join(datapath, 'images')
labels_path = os.path.join(datapath, 'labels')

Expand Down
2 changes: 1 addition & 1 deletion ODRS/ml_utils/config/ml_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GPU: true
accuracy: 10
classes_path: classes.txt
dataset_path: /media/space/ssd_1_tb_evo_sumsung/exp-train/datasets/Monitoring_photo
dataset_path: /home/runner/work/ODRS/ODRS/user_datasets/WaRP/Warp-D
speed: 1
Loading

0 comments on commit 3cf90f3

Please sign in to comment.