neural_network #4
24
src/machine_learning/neural_network/helpers.py
Normal file
24
src/machine_learning/neural_network/helpers.py
Normal file
@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
from torchvision.transforms import transforms
|
||||
|
||||
|
||||
main_path = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
img_main_path = os.path.dirname(main_path)
|
||||
for i in range(2):
|
||||
img_main_path = os.path.dirname(img_main_path)
|
||||
|
||||
img_main_path = os.path.join(img_main_path, 'images/learning')
|
||||
|
||||
train_path = os.path.join(img_main_path, 'training')
|
||||
test_path = os.path.join(img_main_path, 'test')
|
||||
prediction_path = os.path.join(img_main_path, 'prediction')
|
||||
|
||||
transformer = transforms.Compose([
|
||||
transforms.Resize((150, 150)),
|
||||
transforms.RandomHorizontalFlip(),
|
||||
transforms.ToTensor(),
|
||||
transforms.Normalize([0.5, 0.5, 0.5],
|
||||
[0.5, 0.5, 0.5])
|
||||
])
|
Loading…
Reference in New Issue
Block a user