Skip to content

Commit

Permalink
Merge branch 'main' into pytest, resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
1p0d committed Jan 15, 2024
2 parents e295999 + f681747 commit eb0b82e
Show file tree
Hide file tree
Showing 21 changed files with 244 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
docs/site/
data/raw/
lightning_logs/

# test cache
manual_test/

Expand Down Expand Up @@ -175,7 +176,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# DVC
/data
Expand Down
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/DTU-02476-Group-100-Project.iml

This file was deleted.

33 changes: 0 additions & 33 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% if cookiecutter.open_source_license == 'MIT' %}
The MIT License (MIT)
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
Copyright (c) {% now 'utc', '%Y' %}, JonatanRasmussen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{% elif cookiecutter.open_source_license == 'BSD-3-Clause' %}
Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author_name }}
Copyright (c) {% now 'utc', '%Y' %}, JonatanRasmussen
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand All @@ -21,7 +21,7 @@ are permitted provided that the following conditions are met:
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of {{ cookiecutter.project_name }} nor the names of its
* Neither the name of project_winegrape nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# GLOBALS #
#################################################################################

PROJECT_NAME = {{ cookiecutter.project_name }}
PYTHON_VERSION = {{ cookiecutter.python_version_number }}
PROJECT_NAME = project_winegrape_src_files
PYTHON_VERSION = 3.11
PYTHON_INTERPRETER = python

#################################################################################
Expand Down
6 changes: 3 additions & 3 deletions data.dvc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
outs:
- md5: 9d61ac5c5b1aeb3f1ab5cde649e04ea9.dir
size: 0
nfiles: 2
- md5: 8d058593ff5033ab4f934ba52d092839.dir
size: 114539947
nfiles: 503
hash: md5
path: data
4 changes: 2 additions & 2 deletions docs/mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_name: {{ cookiecutter.project_name }}
site_author: {{ cookiecutter.author_name }}
site_name: project_winegrape
site_author: JonatanRasmussen
docs_dir: source

theme:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Documentation

Documentation for {{ cookiecutter.project_name }}
Documentation for project_winegrape

2 changes: 1 addition & 1 deletion project_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The directory structure of the project looks like this:
├── tests <- Test files
├── {{cookiecutter.project_name}} <- Source code for use in this project.
├── project_winegrape_src_files <- Source code for use in this project.
│ │
│ ├── __init__.py <- Makes folder a Python module
│ │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ data:
transform_level: "light"
batch_size: 32
val_split: 0.2
num_workers: 6

model:
model_name: "efficientnet_b0" # or resnetv2_50t
num_classes: 5
drop_rate: 0.3
pretrained: true


optimization:
lr_pretrained: 1e-5
lr_final: 1e-4
optimizer: "AdamW"
criterion: "cross_entropy"

training:
max_epochs: 40
max_epochs: 20

logging:
log_every_n_steps: 40
log_every_n_steps: 5
29 changes: 29 additions & 0 deletions project_winegrape_src_files/conf/config2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
reproducibility:
seed: 123

data:
dir: "data/raw/grapevine-leaves-image-dataset/Grapevine_Leaves_Image_Dataset"
transform_level: "light"
batch_size: 32
val_split: 0.2
num_workers: 6

model:
#model_name: "efficientnet_b0" # or resnetv2_50t
model_name: "CNN"
num_classes: 5
drop_rate: 0.3
pretrained: true


optimization:
lr_pretrained: 1e-5
lr_final: 1e-4
optimizer: "AdamW"
criterion: "cross_entropy"

training:
max_epochs: 20

logging:
log_every_n_steps: 5
15 changes: 10 additions & 5 deletions project_winegrape_src_files/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@ def __init__(
self,
data_dir="data/raw/grapevine-leaves-image-dataset/Grapevine_Leaves_Image_Dataset",
transform_level=None,
batch_size=32,
val_split = 0.2
img_size = 224,
batch_size=8,
val_split = 0.2,
num_workers = 0
):
super().__init__()
self.root_dir = Path(data_dir)
self.transform_level = transform_level
self.img_size = img_size
self.batch_size = batch_size
self.val_split = val_split
self.num_workers = num_workers

self.transform_val,self.transform_train = self.which_transform()

def which_transform(self):

basic_transformation = [
transforms.Resize(self.img_size),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225])
]
Expand Down Expand Up @@ -67,9 +72,9 @@ def setup(self, stage=None):
val_dataset = Subset(val_dataset, indices[:split_idx])
val_dataset, test_dataset = torch.utils.data.random_split(val_dataset, [0.9, 0.1])

self.train_dataset = DataLoader(train_dataset, batch_size=self.batch_size, shuffle=True, num_workers = 31)
self.val_dataset = DataLoader(val_dataset, batch_size=self.batch_size, shuffle = False, num_workers = 31)
self.test_dataset = DataLoader(test_dataset, batch_size=len(test_dataset), shuffle = False, num_workers = 31)
self.train_dataset = DataLoader(train_dataset, batch_size=self.batch_size, shuffle=True, num_workers = self.num_workers)
self.val_dataset = DataLoader(val_dataset, batch_size=self.batch_size, shuffle = False, num_workers = self.num_workers)
self.test_dataset = DataLoader(test_dataset, batch_size=len(test_dataset), shuffle = False, num_workers = self.num_workers)

def train_dataloader(self):
return self.train_dataset
Expand Down
Loading

0 comments on commit eb0b82e

Please sign in to comment.