Skip to content

Commit

Permalink
Merge pull request #76 from vietanhdev/feature/custom_models
Browse files Browse the repository at this point in the history
Feature: Load custom models
  • Loading branch information
vietanhdev authored May 6, 2023
2 parents 7e45e55 + bf75f00 commit 7b4d48d
Show file tree
Hide file tree
Showing 24 changed files with 96,810 additions and 96,247 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ anylabeling/data
/build
/wheels_dist
*_ui.py
anylabeling/app_info.py-*
anylabeling/app_info.py-*
zipped_models/*
4 changes: 3 additions & 1 deletion anylabeling/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from PyQt5 import QtCore, QtWidgets

from anylabeling.app_info import __appname__
from anylabeling.views.labeling.config import get_config
from anylabeling.config import get_config
from anylabeling import config as anylabeling_config
from anylabeling.views.mainwindow import MainWindow
from anylabeling.views.labeling.logger import logger
from anylabeling.views.labeling.utils import new_icon
Expand Down Expand Up @@ -137,6 +138,7 @@ def main():
filename = config_from_args.pop("filename")
output = config_from_args.pop("output")
config_file_or_yaml = config_from_args.pop("config")
anylabeling_config.current_config_file = config_file_or_yaml
config = get_config(config_file_or_yaml, config_from_args)

if not config["labels"] and config["validate_label"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

from anylabeling import configs as anylabeling_configs

from .logger import logger
from .views.labeling.logger import logger


# Save current config file
current_config_file = None


def update_dict(target_dict, new_dict, validate_item=None):
Expand Down Expand Up @@ -68,6 +72,8 @@ def get_config(config_file_or_yaml=None, config_from_args=None):
config = get_default_config()

# 2. specified as file or yaml
if config_file_or_yaml is None:
config_file_or_yaml = current_config_file
if config_file_or_yaml is not None:
config_from_yaml = yaml.safe_load(config_file_or_yaml)
if not isinstance(config_from_yaml, dict):
Expand Down
4 changes: 4 additions & 0 deletions anylabeling/configs/anylabeling_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ shortcuts:
ungroup_selected_shapes: U

auto_label: Ctrt+A


# Auto labeling
custom_models: []
30 changes: 15 additions & 15 deletions anylabeling/configs/auto_labeling/models.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
- model_name: "segment_anything_vit_b_quant-r20230416"
config_file: "segment_anything_vit_b_quant.yaml"
config_file: ":/segment_anything_vit_b_quant.yaml"
- model_name: "segment_anything_vit_b-r20230416"
config_file: "segment_anything_vit_b.yaml"
config_file: ":/segment_anything_vit_b.yaml"
- model_name: "segment_anything_vit_l_quant-r20230416"
config_file: "segment_anything_vit_l_quant.yaml"
config_file: ":/segment_anything_vit_l_quant.yaml"
- model_name: "segment_anything_vit_l-r20230416"
config_file: "segment_anything_vit_l.yaml"
config_file: ":/segment_anything_vit_l.yaml"
- model_name: "segment_anything_vit_h_quant-r20230416"
config_file: "segment_anything_vit_h_quant.yaml"
config_file: ":/segment_anything_vit_h_quant.yaml"
- model_name: "yolov5n-r20230415"
config_file: "yolov5n.yaml"
config_file: ":/yolov5n.yaml"
- model_name: "yolov5s-r20230415"
config_file: "yolov5s.yaml"
config_file: ":/yolov5s.yaml"
- model_name: "yolov5m-r20230415"
config_file: "yolov5m.yaml"
config_file: ":/yolov5m.yaml"
- model_name: "yolov5l-r20230415"
config_file: "yolov5l.yaml"
config_file: ":/yolov5l.yaml"
- model_name: "yolov5x-r20230415"
config_file: "yolov5x.yaml"
config_file: ":/yolov5x.yaml"
- model_name: "yolov8n-r20230415"
config_file: "yolov8n.yaml"
config_file: ":/yolov8n.yaml"
- model_name: "yolov8s-r20230415"
config_file: "yolov8s.yaml"
config_file: ":/yolov8s.yaml"
- model_name: "yolov8m-r20230415"
config_file: "yolov8m.yaml"
config_file: ":/yolov8m.yaml"
- model_name: "yolov8l-r20230415"
config_file: "yolov8l.yaml"
config_file: ":/yolov8l.yaml"
- model_name: "yolov8x-r20230415"
config_file: "yolov8x.yaml"
config_file: ":/yolov8x.yaml"
191,344 changes: 95,743 additions & 95,601 deletions anylabeling/resources/resources.py

Large diffs are not rendered by default.

Loading

0 comments on commit 7b4d48d

Please sign in to comment.