Lars2000 commited on
Commit
fda1d5a
·
1 Parent(s): d41c6d9

Add markups

Browse files
Files changed (2) hide show
  1. train.html +0 -0
  2. train.ipynb +92 -1
train.html ADDED
The diff for this file is too large to render. See raw diff
 
train.ipynb CHANGED
@@ -1,5 +1,33 @@
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 65,
@@ -38,6 +66,21 @@
38
  "print(\"Num GPUs Available: \", len(tf.config.list_physical_devices('GPU')))\n"
39
  ]
40
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  {
42
  "cell_type": "code",
43
  "execution_count": 67,
@@ -145,6 +188,13 @@
145
  " print(\"Min and max pixel values:\", images[0].numpy().min(), images[0].numpy().max())\n"
146
  ]
147
  },
 
 
 
 
 
 
 
148
  {
149
  "cell_type": "code",
150
  "execution_count": 70,
@@ -217,6 +267,14 @@
217
  "number_of_classes = len(train_ds.class_names)"
218
  ]
219
  },
 
 
 
 
 
 
 
 
220
  {
221
  "cell_type": "code",
222
  "execution_count": 73,
@@ -300,6 +358,19 @@
300
  "print(\"Length of the TensorFlow dataset:\", dataset_length)"
301
  ]
302
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  {
304
  "cell_type": "code",
305
  "execution_count": 76,
@@ -2228,7 +2299,7 @@
2228
  "import matplotlib.pyplot as plt\n",
2229
  "import seaborn as sns\n",
2230
  "\n",
2231
- "cm = confusion_matrix(y_true, y_pred)\n",
2232
  "\n",
2233
  "plt.figure(figsize=(10, 8))\n",
2234
  "sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=class_names, yticklabels=class_names)\n",
@@ -2298,6 +2369,26 @@
2298
  " plot_images(images, labels, predictions)\n",
2299
  " plt.show()\n"
2300
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2301
  }
2302
  ],
2303
  "metadata": {
 
1
  {
2
  "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Sentinel Satellite Image Classification Project\n",
8
+ "\n"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "metadata": {},
14
+ "source": [
15
+ "## Project Overview\n",
16
+ "\n",
17
+ "This project focuses on the development and deployment of a machine learning application for satellite image classification. The goal is to automate the classification of satellite images into predefined categories that represent different types of land cover.\n",
18
+ "\n",
19
+ "## Motivation\n",
20
+ "\n",
21
+ "### End Users\n",
22
+ "The end users of this project are environmental scientists and urban planners.\n",
23
+ "\n",
24
+ "### Goal of End Users\n",
25
+ "Their goal is to utilize automated tools to classify large volumes of satellite imagery quickly and accurately for environmental monitoring and urban planning purposes.\n",
26
+ "\n",
27
+ "### Obstacle to be Solved\n",
28
+ "The main obstacles include the high variability and similarity between different land cover types in satellite images and the volume of data that requires processing.\n"
29
+ ]
30
+ },
31
  {
32
  "cell_type": "code",
33
  "execution_count": 65,
 
66
  "print(\"Num GPUs Available: \", len(tf.config.list_physical_devices('GPU')))\n"
67
  ]
68
  },
69
+ {
70
+ "cell_type": "markdown",
71
+ "metadata": {},
72
+ "source": [
73
+ "## Data Collection and Augmentation\n",
74
+ "\n",
75
+ "### Images Collected\n",
76
+ "The dataset used in this project is the EuroSAT collection, which consists of 30,988 satellite images derived from Sentinel satellites. These images are categorized into ten classes representing different types of land cover: AnnualCrop, Forest, HerbaceousVegetation, Highway, Industrial, Pasture, PermanentCrop, Residential, River, SeaLake.\n",
77
+ "\n",
78
+ "### Description of Splitting Images into Classes/Labeling Images\n",
79
+ "The EuroSAT images come pre-labeled, which facilitates the classification task. The dataset was split into a training set comprising 80% of the images and a validation set comprising 20%, ensuring a comprehensive evaluation of the model across varied image data.\n",
80
+ "\n",
81
+ "\n"
82
+ ]
83
+ },
84
  {
85
  "cell_type": "code",
86
  "execution_count": 67,
 
188
  " print(\"Min and max pixel values:\", images[0].numpy().min(), images[0].numpy().max())\n"
189
  ]
190
  },
191
+ {
192
+ "cell_type": "code",
193
+ "execution_count": null,
194
+ "metadata": {},
195
+ "outputs": [],
196
+ "source": []
197
+ },
198
  {
199
  "cell_type": "code",
200
  "execution_count": 70,
 
267
  "number_of_classes = len(train_ds.class_names)"
268
  ]
269
  },
270
+ {
271
+ "cell_type": "markdown",
272
+ "metadata": {},
273
+ "source": [
274
+ "### Data Augmentation Description\n",
275
+ "To enhance the robustness of the model against variations in real-world satellite images, several data augmentation techniques were applied. These included random flips (both horizontal and vertical), random rotations (up to 20 degrees), random zoom (up to 20%), and random contrast adjustments. These techniques help simulate different capture conditions and photographic variations, aiding the model in learning more generalized features."
276
+ ]
277
+ },
278
  {
279
  "cell_type": "code",
280
  "execution_count": 73,
 
358
  "print(\"Length of the TensorFlow dataset:\", dataset_length)"
359
  ]
360
  },
361
+ {
362
+ "cell_type": "markdown",
363
+ "metadata": {},
364
+ "source": [
365
+ "## Model Training\n",
366
+ "\n",
367
+ "### Initial Training and Fine Tuning\n",
368
+ "The model's initial training utilized a pre-trained EfficientNetB0 architecture with the top layers tailored for our classification needs. The base model's layers were initially frozen. Fine-tuning was later applied by unfreezing all layers and continuing training, which refined the model's ability to classify complex images more accurately.\n",
369
+ "\n",
370
+ "### Comparison of Performance\n",
371
+ "Initially, the model achieved a validation accuracy of around 92%. Post fine-tuning, this accuracy improved to approximately 94%. This indicates the effectiveness of fine-tuning in enhancing the model's capability to distinguish subtle features in satellite images.\n"
372
+ ]
373
+ },
374
  {
375
  "cell_type": "code",
376
  "execution_count": 76,
 
2299
  "import matplotlib.pyplot as plt\n",
2300
  "import seaborn as sns\n",
2301
  "\n",
2302
+ "cm = confusion_matrix(y_true, y_pred)a\n",
2303
  "\n",
2304
  "plt.figure(figsize=(10, 8))\n",
2305
  "sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=class_names, yticklabels=class_names)\n",
 
2369
  " plot_images(images, labels, predictions)\n",
2370
  " plt.show()\n"
2371
  ]
2372
+ },
2373
+ {
2374
+ "cell_type": "markdown",
2375
+ "metadata": {},
2376
+ "source": [
2377
+ "## Model Application\n",
2378
+ "\n",
2379
+ "### Deployment\n",
2380
+ "The model was deployed using a Gradio web interface, which provides a user-friendly GUI for uploading images and receiving instant classifications.\n",
2381
+ "\n",
2382
+ "### Demo\n",
2383
+ "A live demo of the application can be accessed at: [https://huggingface.co/spaces/Lars2000/sentinel](https://huggingface.co/spaces/Lars2000/sentinel)\n",
2384
+ "\n",
2385
+ "### Results of User Validation\n",
2386
+ "User feedback highlighted the application's ease of use and accuracy. Positive points included quick response times and informative confidence scores for different classifications. Suggestions for improvement were focused on enhancing performance with low-contrast images and those affected by cloud cover.\n",
2387
+ "\n",
2388
+ "## Conclusion\n",
2389
+ "\n",
2390
+ "The project successfully demonstrated the application of convolutional neural networks in classifying satellite imagery, utilizing both transfer learning and fine-tuning approaches to achieve high accuracy. Future improvements could address the challenges identified through user feedback, potentially involving the incorporation of additional data preprocessing steps or advanced neural network architectures.\n"
2391
+ ]
2392
  }
2393
  ],
2394
  "metadata": {