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

Add training and dataset managemnt #161

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ requirements:
- python-elf
- napari
- python-graphviz
- pyqt

test:
imports:
Expand Down
35 changes: 22 additions & 13 deletions plantseg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import os
from pathlib import Path

import yaml

# Find the global path of plantseg
plantseg_global_path = Path(__file__).parent.absolute()
PLANTSEG_GLOBAL_PATH = Path(__file__).parent.absolute()

# Create configs directory at startup
home_path = os.path.expanduser("~")
PLANTSEG_MODELS_DIR = ".plantseg_models"
USER_HOME_PATH = Path.home()

configs_path = os.path.join(home_path, PLANTSEG_MODELS_DIR, "configs")
os.makedirs(configs_path, exist_ok=True)
PLANTSEG_LOCAL_DIR = USER_HOME_PATH / '.plantseg'
PLANTSEG_MODELS_DIR = PLANTSEG_LOCAL_DIR / 'models'
PLANTSEG_MODELS_DIR.mkdir(parents=True, exist_ok=True)

# create custom zoo if does not exist
custom_zoo = os.path.join(home_path, PLANTSEG_MODELS_DIR, 'custom_zoo.yaml')
# create a user zoo config if does not exist
USER_MODEL_ZOO_CONFIG = PLANTSEG_MODELS_DIR / 'user_model_zoo.yaml'

if not os.path.exists(custom_zoo):
with open(custom_zoo, 'w') as f:
if not USER_MODEL_ZOO_CONFIG.exists():
with open(USER_MODEL_ZOO_CONFIG, 'w') as f:
yaml.dump({}, f)

CONFIGS_PATH = PLANTSEG_LOCAL_DIR / 'configs'
CONFIGS_PATH.mkdir(parents=True, exist_ok=True)

# create a custom datasets config if does not exist
USER_DATASETS_CONFIG = PLANTSEG_LOCAL_DIR / 'user_datasets.yaml'

if not USER_DATASETS_CONFIG.exists():
with open(USER_DATASETS_CONFIG, 'w') as f:
yaml.dump({}, f)

# Resources directory
RESOURCES_DIR = "resources"
model_zoo_path = os.path.join(plantseg_global_path, RESOURCES_DIR, "models_zoo.yaml")
standard_config_template = os.path.join(plantseg_global_path, RESOURCES_DIR, "config_gui_template.yaml")
RESOURCES_DIR = PLANTSEG_GLOBAL_PATH / 'resources'
MODEL_ZOO_PATH = RESOURCES_DIR / 'models_zoo.yaml'
STANDARD_CONFIG_TEMPLATE = RESOURCES_DIR / 'config_gui_template.yaml'
File renamed without changes.
Loading
Loading