• Categories
  • Recent
  • Popular
  • Tags
  • Users
  • Groups
  • Register
  • Login
MakerGram Logo

MakerGram

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Popular
  • Tags
  • Users
  • Groups
  1. Home
  2. sreu13
  3. Best
S
  • Profile
  • Following 2
  • Followers 0
  • Topics 2
  • Posts 18
  • Best 2
  • Controversial 0
  • Groups 1

Best posts made by sreu13

  • RE: [Solved] leaf disease detection using keras

    @salmanfaris i know there was a delay in replies, i thought of finishing the project and replying here!....
    i ddnt get the exact reason, but the problem was solved

    what i did was , label binarized was working fine when i did created the training model. So i loaded my training model and deleted the script for the training procedure. i ended up with the code given below. and it worked up fine.

    import numpy as np
    import pickle
    import cv2
    from os import listdir
    from sklearn.preprocessing import LabelBinarizer
    from keras.models import Sequential
    from keras.layers.normalization import BatchNormalization
    from keras.layers.convolutional import Conv2D
    from keras.layers.convolutional import MaxPooling2D
    from keras.layers.core import Activation, Flatten, Dropout, Dense
    from keras import backend as K
    from keras.preprocessing.image import ImageDataGenerator
    from keras.optimizers import Adam
    from keras.preprocessing import image
    from keras.preprocessing.image import img_to_array
    from sklearn.preprocessing import MultiLabelBinarizer
    from sklearn.model_selection import train_test_split
    import matplotlib.pyplot as plt
    
    EPOCHS = 25
    INIT_LR = 1e-3
    BS = 32
    default_image_size = tuple((256, 256))
    image_size = 0
    directory_root = 'PlantVillage'
    width=256
    height=256
    depth=3
    
    #Function to convert images to array
    def convert_image_to_array(image_dir):
        try:
            image = cv2.imread(image_dir)
            if image is not None :
                image = cv2.resize(image, default_image_size)   
                return img_to_array(image)
            else :
                return np.array([])
        except Exception as e:
            print(f"Error : {e}")
            return None
    
    listdir(directory_root)
    
    image_list, label_list = [], []
    try:
        print("[INFO] Loading images ...")
        root_dir = listdir(directory_root)
        for directory in root_dir :
            # remove .DS_Store from list
            if directory == ".DS_Store" :
                root_dir.remove(directory)
    
        for plant_folder in root_dir :
            plant_disease_folder_list = listdir(f"{directory_root}/{plant_folder}")
            
            for disease_folder in plant_disease_folder_list :
                # remove .DS_Store from list
                if disease_folder == ".DS_Store" :
                    plant_disease_folder_list.remove(disease_folder)
    
            for plant_disease_folder in plant_disease_folder_list:
                print(f"[INFO] Processing {plant_disease_folder} ...")
                plant_disease_image_list = listdir(f"{directory_root}/{plant_folder}/{plant_disease_folder}")
               
                    
                for single_plant_disease_image in plant_disease_image_list :
                    if single_plant_disease_image == ".DS_Store" :
                        plant_disease_image_list.remove(single_plant_disease_image)
    
                for image in plant_disease_image_list[:200]:
                    image_directory = f"{directory_root}/{plant_folder}/{plant_disease_folder}/{image}"
                    if image_directory.endswith(".jpg") == True or image_directory.endswith(".JPG") == True:
                        image_list.append(convert_image_to_array(image_directory))
                        label_list.append(plant_disease_folder)
        print("[INFO] Image loading completed")  
    except Exception as e:
        print(f"Error : {e}")
    
    image_size = len(image_list)
    
    #Transform Image Labels uisng Scikit Learn's LabelBinarizer
    label_binarizer = LabelBinarizer()
    image_labels = label_binarizer.fit_transform(label_list)
    pickle.dump(label_binarizer,open('label_transform.pkl', 'wb'))
    n_classes = len(label_binarizer.classes_)
    
    #Print the classes
    print(label_binarizer.classes_)
    
    #load saved pickle model
    loaded_model = pickle.load(open('cnn_model.pkl', 'rb'))
    model_disease=loaded_model
    
    
    #load plant leaf image
    image_dir="plantdisease/Validation_Set/Potato___Early_blight/1d301622-e359-49d5-b4ca-6837f254fd1b___RS_Early.B 6719.JPG"
    
    #convert leaf image to arrays
    im=convert_image_to_array(image_dir)
    np_image_li = np.array(im, dtype=np.float16) / 225.0
    npp_image = np.expand_dims(np_image_li, axis=0)
    
    result=model_disease.predict(npp_image)
    print(result)
    
    #printing result
    itemindex = np.where(result==np.max(result))
    print("probability:"+str(np.max(result))+"\n"+label_binarizer.classes_[itemindex[1][0]])
    
    posted in General Discussion
    S
    sreu13
    29 Mar 2020, 11:11
  • RE: Error on Raspberry PI 4 while opening TensorFlow.

    @arunksoman thankyou so much...your reply really busted the stress out of me...can you help with any documentations which i could possibly go through

    posted in General Discussion
    S
    sreu13
    30 Mar 2020, 16:51

Recent Posts

  • @Neha-Kamal Nice one, Can you share the project link also here. Thanks 🙌.

    20 Jul 2025, 06:13 • read more
  • A

    Solution Architecture
    Module Selection: Miniature surface-mount PIR modules (e.g., HC-SR501) with size <20mm×20mm for integration into embedded lighting (ceiling lights, corridor lamps).
    Linkage Logic: Connect to MCUs (e.g., ESP32) via GPIO for "person detected - full brightness; person present - dimmed; person leaves - 30s delay off" control. Integrate light sensors (e.g., BH1750) for daytime auto-shutdown.
    Energy Savings: Reduces lighting energy consumption by 30%-50% compared to traditional switches, ideal for corridors and bathrooms.

    Typical Scenarios Smart Homes: Integrates with Alexa/Mijia systems, allowing APP-adjustable sensing distance and delays. Commercial Lighting: Mall corridors use zoned sensing via RS485 bus for collaborative multi-module control.

    III. Optimization of Sensing Solutions for Security Systems

    Enhanced Intrusion Detection Design Anti-Interference Technology: Dual-element complementary sensors suppress ambient temperature interference; pulse counting (2 consecutive pulses trigger alarm) reduces false positives. Multi-Dimensional Linkage: Combines with microwave radar modules (e.g., HB100) for "infrared + microwave" dual detection, triggering alarms only when both activate to avoid curtain sway or insect interference. Concealed Installation: Modules with integrated lens-housing designs (e.g., RE200B) hide within ceilings or decor for covert security. Data Transmission and Response Wireless Transmission: LoRa modules (e.g., EBYTE E32-433T30D) enable low-power long-range (3km open area) data upload, suitable for villa/factory perimeter security. Rapid Response: <0.5s trigger delay, with local buzzer alerts and cloud notifications (via NB-IoT) within <3s.

    IV. Selection and Deployment Considerations

    Environmental Adaptation Avoid direct exposure to air vents/heating sources. Install at 2.2-2.8m (indoor) or 3-5m (outdoor) height, tilted 15°-30° to cover human activity zones. Outdoor use requires IP65 waterproof modules (e.g., AM312-IP67) with sunshades to minimize solar interference. Cost-Reliability Balance Consumer scenarios: HC-SR501 (~$2/unit); industrial use: Prioritize stability (e.g., Panasonic EKMC1603111, temp drift <±2%/℃). Batch deployment: Reserve 10% redundant modules with self-diagnostic voltage checks for fault

    18 Jul 2025, 06:00 • read more
By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
Copyright © 2023 MakerGram, All rights reserved.
Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct