This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Classification import ImageClassification | |
import os | |
execution_path = os.getcwd() | |
prediction = ImageClassification() | |
prediction.setModelTypeAsResNet50() | |
prediction.setModelPath( execution_path + "\resnet50_imagenet_tf.2.0.h5") | |
prediction.loadModel() | |
predictions, percentage_probabilities = prediction.classifyImage("C:\Users\MyUser\Downloads\sample.jpg", result_count=5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Detection import ObjectDetection | |
import os | |
execution_path = os.getcwd() | |
detector = ObjectDetection() | |
detector.setModelTypeAsRetinaNet() | |
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.1.0.h5")) | |
detector.loadModel() | |
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Detection import ObjectDetection | |
import os | |
execution_path = os.getcwd() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
detector = ObjectDetection() | |
detector.setModelTypeAsRetinaNet() | |
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5")) | |
detector.loadModel() | |
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for eachObject in detections: | |
print(eachObject["name"] , " : " , eachObject["percentage_probability"] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
detections, extracted_images = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg"), extract_detected_objects=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Classification.Custom import ClassificationModelTrainer | |
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Classification.Custom import CustomImageClassification | |
import os | |
execution_path = os.getcwd() | |
prediction = CustomImageClassification() | |
prediction.setModelTypeAsResNet50() | |
prediction.setModelPath("idenprof_061-0.7933.h5") | |
prediction.setJsonPath("idenprof_model_class.json") | |
prediction.loadModel(num_objects=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Detection import VideoObjectDetection | |
import os | |
execution_path = os.getcwd() | |
detector = VideoObjectDetection() | |
detector.setModelTypeAsYOLOv3() | |
detector.setModelPath( os.path.join(execution_path , "yolo.h5")) | |
detector.loadModel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageai.Detection import VideoObjectDetection | |
import os | |
import cv2 | |
execution_path = os.getcwd() | |
camera = cv2.VideoCapture(0) | |
detector = VideoObjectDetection() | |
detector.setModelTypeAsYOLOv3() |
OlderNewer