[Solved] leaf disease detection using keras
-
i've entered this code,
def fit_transform(self, n_classes):
but as I run it, I get the indentation Error given below
File"C:/Users/admin/Desktop/plant_disease_classification/plant_disease_classification/untitled1.py", line 42
label_binarizer = LabelBinarizer()
^
IndentationError: expected an indented block -
@sreu13
fit and fit_transform are actually inbuilt functions found in the scikit-learn library. So I'd suggest you fit your model with the available data using those functions whose application can be found on scikit-learn's documentation and then proceed with the Binarizer. -
@SuperGops
so basically ,i'll have to restart and retrain the model with fit_transform? -
@sreu13 Yup
-
Could you please follow my steps:
- Uninstall your current Python 3.7 version
- Install Python 3.6.5
- If you are using spyder editor make a change to vscode.
- Go to integrated terminal of vscode and create a virtual environment
python -m venv venv
- Activate your virtual environment
.\venv\Scripts\activate
- Create a requirements.txt over your current working directory. Contents for requirements.txt given below:
h5py==2.8.0 imutils==0.5.1 Keras==2.2.4 Keras-Applications==1.0.6 Keras-Preprocessing==1.0.5 kiwisolver==1.0.1 matplotlib==3.0.2 numpy==1.15.3 opencv-contrib-python==3.4.3.18 Pillow==5.3.0 PyWavelets==1.0.1 scikit-image==0.14.1 scikit-learn==0.20.0 scipy==1.1.0 six==1.11.0 sklearn==0.0 tensorboard==1.12.0 tensorflow==1.12.0 termcolor==1.1.0 toolz==0.9.0
- Then install necessary packages using requirements.txt file
pip install -r requirements.txt
- Then run your code within this venv and say what happened as reply here.
-
@SuperGops
i also have another pickle file "label_transform", which I got as an output from referring the initial code from gaggle, is there any use of this file?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_)
Kaggle >https://www.kaggle.com/emmarex/plant-disease-detection-using-keras/data
-
@arunksoman
i'll follow this proceedure, but would I be able to deploy this code in raspberry pi 4? -
@sreu13 As the @SuperGops says you have to use fit_transform. It can be implemented on Raspberry Pi 4. But if it slows down your pi you have use multiprocessing as well as threads to improve that.
-
@arunksoman
by multiprocessing, do you mean to use multilabel binarizer, if yes , then I have already used it during the training process.
@SuperGops , fit_transform has also been used in the code prior to using label_binarizer. -
@sreu13 I didn't mean that. I said if you are trying to run your code on RasPi4 or any other version of RasPi, you have to do some optimization on the code for better performance. Then Multiprocessing and threading Module comes into the picture.