<jupyter_start><jupyter_text>object detection source:https://github.com/OlafenwaMoses/ImageAI/blob/master/imageai/Detection/README.mdobjectextraction<jupyter_code>img_b = 'h_40_v_-127.jpg'
img_a = 'detected_' + img_b<jupyter_output><empty_output><jupyter_text>load a pre-trained model and excuting obj detection<jupyter_code>execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path , "resnet50_v2.1.0.h5"))<jupyter_output><empty_output><jupyter_text>load model, normal mode<jupyter_code>detector.loadModel()<jupyter_output><empty_output><jupyter_text>mode: "normal"(default), "fast", "faster" , "fastest" and "flash".<jupyter_code>detector.loadModel(detection_speed="fast")<jupyter_output>WARNING:tensorflow:No training configuration found in the save file, so the model was *not* compiled. Compile it manually.<jupyter_text>run detection, full detection<jupyter_code>detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path ,img_b),
                                             output_image_path=os.path.join(execution_path , img_a))<jupyter_output><empty_output><jupyter_text>Specify which object type need to be detect, optional customized detection hide name on output image hide probability  availiable object type:  person,  bicycle,  car, motorcycle, airplane, bus, train,  truck,  boat,  traffic light,  fire hydrant, stop_sign,parking meter,   bench,   bird,   cat,   dog,   horse,   sheep,   cow,   elephant,   bear,   zebra,giraffe,   backpack,   umbrella,   handbag,   tie,   suitcase,   frisbee,   skis,   snowboard,sports ball,   kite,   baseball bat,   baseball glove,   skateboard,   surfboard,   tennis racket,bottle,   wine glass,   cup,   fork,   knife,   spoon,   bowl,   banana,   apple,   sandwich,   orange,broccoli,   carrot,   hot dog,   pizza,   donot,   cake,   chair,   couch,   potted plant,   bed,dining table,   toilet,   tv,   laptop,   mouse,   remote,   keyboard,   cell phone,   microwave,   oven,toaster,   sink,   refrigerator,   book,   clock,   vase,   scissors,   teddy bear,   hair dryer,   toothbrush.<jupyter_code>custom_objects = detector.CustomObjects(person=True)
detections = detector.detectObjectsFromImage(custom_objects = custom_objects,
                                             input_image = os.path.join(execution_path ,img_b),
                                             output_image_path = os.path.join(execution_path , img_a),
                                             minimum_percentage_probability = 30, display_object_name=False,
                                             display_percentage_probability=False)<jupyter_output><empty_output><jupyter_text>Print detected items and probability<jupyter_code>for eachObject in detections:
    print(eachObject["name"] , " : " , eachObject["percentage_probability"] )<jupyter_output>person  :  71.16817235946655
{'fraction_non_alphanumeric': 0.09601634320735444, 'fraction_numerical': 0.009874021109976166, 'mean_word_length': 3.8401976935749587, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '583354', 'license': 'MIT', 'n_tokens_mistral': 954, 'n_tokens_neox': 935, 'n_words': 184, 'path': 'AI_detect/humanDetection.ipynb', 'repo_name': 'Hanq416/IndoorLocationDetection_ThetaZ1', 'size': '2937'}