Skip to content

Commit

Permalink
updated README for Custom Classification and Training
Browse files Browse the repository at this point in the history
  • Loading branch information
OlafenwaMoses committed Jan 5, 2021
1 parent 2b56e73 commit 94a2d22
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 643 deletions.
18 changes: 0 additions & 18 deletions examples/custom_full_model_prediction.py

This file was deleted.

6 changes: 3 additions & 3 deletions examples/custom_model_continuos_training.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from imageai.Prediction.Custom import ModelTraining
from imageai.Classification.Custom import ClassificationModelTrainer
import os

trainer = ModelTraining()
trainer.setModelTypeAsDenseNet()
trainer = ClassificationModelTrainer()
trainer.setModelTypeAsDenseNet121()
trainer.setDataDirectory("idenprof")
trainer.trainModel(num_objects=10, num_experiments=50, enhance_data=True, batch_size=8, show_network_summary=True, continue_from_model="idenprof_densenet-0.763500.h5") # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/models-v3

16 changes: 0 additions & 16 deletions examples/custom_model_convert_deepstack.py

This file was deleted.

16 changes: 0 additions & 16 deletions examples/custom_model_convert_to_tensorflow.py

This file was deleted.

10 changes: 5 additions & 5 deletions examples/custom_model_prediction.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from imageai.Prediction.Custom import CustomImagePrediction
from imageai.Classification.Custom import CustomImageClassification
import os

execution_path = os.getcwd()

prediction = CustomImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath(os.path.join(execution_path, "idenprof_resnet.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/models-v3
prediction = CustomImageClassification()
prediction.setModelTypeAsResNet50()
prediction.setModelPath(os.path.join(execution_path, "idenprof_resnet_ex-056_acc-0.993062.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/models-v3
prediction.setJsonPath(os.path.join(execution_path, "idenprof.json"))
prediction.loadModel(num_objects=10)

predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "9.jpg"), result_count=5)
predictions, probabilities = prediction.classifyImage(os.path.join(execution_path, "9.jpg"), result_count=5)

for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction , " : " , eachProbability)
6 changes: 3 additions & 3 deletions examples/custom_model_training.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from imageai.Prediction.Custom import ModelTraining
from imageai.Classification.Custom import ClassificationModelTrainer


model_trainer = ModelTraining()
model_trainer.setModelTypeAsResNet()
model_trainer = ClassificationModelTrainer()
model_trainer.setModelTypeAsResNet50()
model_trainer.setDataDirectory("idenprof")
model_trainer.trainModel(num_objects=10, num_experiments=200, enhance_data=True, batch_size=32, show_network_summary=True)
6 changes: 3 additions & 3 deletions examples/custom_model_transfer_learning_training.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from imageai.Prediction.Custom import ModelTraining
from imageai.Classification.Custom import ClassificationModelTrainer
import os

trainer = ModelTraining()
trainer.setModelTypeAsResNet()
trainer = ClassificationModelTrainer()
trainer.setModelTypeAsResNet50()
trainer.setDataDirectory("idenprof")
trainer.trainModel(num_objects=10, num_experiments=50, enhance_data=True, batch_size=16, show_network_summary=True,transfer_from_model="resnet50_weights_tf_dim_ordering_tf_kernels.h5", initial_num_objects=1000) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/models-v3
40 changes: 0 additions & 40 deletions examples/custom_multiple_models_predict.py

This file was deleted.

9 changes: 0 additions & 9 deletions examples/detection_config.json

This file was deleted.

10 changes: 5 additions & 5 deletions examples/image_prediction.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from imageai.Prediction import ImagePrediction
from imageai.Classification import ImageClassification
import os

execution_path = os.getcwd()

prediction = ImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath(os.path.join(execution_path, "resnet50_weights_tf_dim_ordering_tf_kernels.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/1.0
prediction = ImageClassification()
prediction.setModelTypeAsResNet50()
prediction.setModelPath(os.path.join(execution_path, "resnet50_imagenet_tf.2.0.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/1.0
prediction.loadModel()

predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "1.jpg"), result_count=10)
predictions, probabilities = prediction.classifyImage(os.path.join(execution_path, "1.jpg"), result_count=10)
for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction , " : " , eachProbability)
Loading

0 comments on commit 94a2d22

Please sign in to comment.