Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
"cells": [
{
"cell_type": "code",
"execution_count": 32,
"id": "9330c509-d3bb-49b4-bb6b-6b32496392db",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: numpy in c:\\users\\prisc\\anaconda3\\envs\\tf\\lib\\site-packages (1.26.4)\n"
]
}
],
"source": [
"!pip install numpy"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "d696d8bb-1f96-4829-bbba-9e4eab24c5ec",
"metadata": {},
"outputs": [],
"source": [
"import skimage\n",
"import sklearn\n",
"import numpy as np\n",
"import tensorflow as tf\n",
"import keras\n",
"import os\n",
"from PIL import Image\n",
"from sklearn.model_selection import StratifiedShuffleSplit\n",
"#import matplotlib\n",
"\n",
"dataset_path = os.path.abspath(\"Dataset/Cropped\")\n",
"\n",
"# Import labeled dataset.\n",
"os.listdir(dataset_path)\n",
"images = []\n",
"image_labels = []\n",
"numbers = [\"zero\",\"one\",\"two\",\"three\",\"four\",\"five\",\"six\"]\n",
"for filename in os.listdir(dataset_path):\n",
" images.append(np.array(Image.open(os.path.join(dataset_path,filename))))\n",
" image_labels.append(numbers.index(filename.split(sep=\"_\")[0]))\n",
"\n",
"# Split into test and training sets.\n",
"sss = StratifiedShuffleSplit(20,train_size=0.75,random_state=0)\n",
"#for (train_index,test_index) in split()\n",
"# Train neural network\n",
"\n",
"# Image analysis\n",
"\n",
"# Image segmentation.\n",
"\n",
"# "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}