Skip to content

Commit

Permalink
added data_download script
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyIITR committed Jan 15, 2024
1 parent 1890355 commit 3e919e7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
14 changes: 14 additions & 0 deletions data_download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import zipfile
from google.cloud import storage

key_file_path = "key_service_account.json"
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = key_file_path

storage_client = storage.Client()
bucket = storage_client.bucket("smoke_detection")
blob = bucket.blob("smoke_artifacts.zip")
blob.download_to_filename("smoke_artifacts.zip")
unzip_path = ""
with zipfile.ZipFile("smoke_artifacts.zip", 'r') as zip_ref:
zip_ref.extractall(unzip_path)
1 change: 0 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
model_evalution = EvaluationPipeline()
model_evalution.main()
logger.info(f">>>>>> stage {STAGE_NAME} completed <<<<<<\n\nx==========x")

except Exception as e:
logger.exception(e)
raise e
2 changes: 1 addition & 1 deletion params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ IMAGE_SIZE: [224, 224]
BATCH_SIZE: 32
LEARNING_RATE: 0.001
batch_size : 32 # set batch size for training
epochs : 5 # number of all epochs in training
epochs : 10 # number of all epochs in training
patience : 1 #number of epochs to wait to adjust lr if monitored value does not improve
stop_patience : 3 # number of epochs to wait before stopping training if monitored value does not improve
threshold : 0.9 # if train accuracy is < threshold adjust monitor accuracy, else monitor validation loss
Expand Down
4 changes: 2 additions & 2 deletions scores.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"loss": 0.12056513875722885,
"accuracy": 0.9553571343421936
"loss": 0.13449855148792267,
"accuracy": 0.96875
}
2 changes: 1 addition & 1 deletion src/cnnClassifier/components/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def train(self, callback_list: list):
self.model.compile(loss=tf.keras.losses.SparseCategoricalCrossentropy(),
optimizer=tf.keras.optimizers.Adam(learning_rate=self.config.learning_rate),
metrics=['accuracy'])
fine_tune_epochs = self.config.epochs + 5
fine_tune_epochs = self.config.epochs + 10
self.history = self.model.fit(self.train_gen, epochs=fine_tune_epochs,
steps_per_epoch=len(self.train_gen),
initial_epoch=self.history.epoch[-1],
Expand Down

0 comments on commit 3e919e7

Please sign in to comment.