Open linchunmian opened 4 years ago
HI, thanks for your great work. I want to use the pretrained model on PKL dataset to test a video, how should I do step by step? How to save the model and how to input a video for inference?
I wrote "How to use" at the "Usage" section in README.md. In order to input for a video, you refer to Face detection using a webcam. Good luck!
Git clone https://github.com/anthng/Car-Parking-Occupancy-Detection.git
pip install -r requirements.txt
in your terminal.In your terminal
Feature extraction by CNN, and SVM classifier
python extract_feats.py
- Use CNN model to extract featurespython svm_clf_from_cnn_feats.py
- Run SVM classifierIn python svm_clf_from_cnn_feats.py
, you import pickle
library. Add pickle.dump(...)
line after clf.fit(X_train, y_train)
.
E.g:
import pickle
...
clf.fit(X_train, y_train)
pickle.dump(clf, open('<path_to_save_model>', 'wb'))
clf= pickle.load(open('<path_to_save_model>', 'rb'))
Thanks. But how to use the train.py? Is it for model training? I am confused that how to use these scripts step by step, and save a good model for video inference. Please help me! Thanks.
I mean, if I want to connect to a wecam to conduct parking slot surveillance online, how should I train a model and use for inference?
I mean, if I want to connect to a wecam to conduct parking slot surveillance online, how should I train a model and use for inference?
Do you want to apply this repo to an online system? I can show you an overview of what to do.
You use train.py
to train the model and save the best model. You need to write a prediction file (predict.py).
In prediction file,
You write a function to detect parking space (I don't have the bounding box of the parking slot to write this function), and a function to draw the output when the parking slot is occupied/ empty.
image = cv2.imread(img)
image = cv2.resize(image, (WIDTH, HEIGHT))
image_x = np.expand_dims(image, axis=0)
image_x = preprocess_input(image_x)
That's all, I hope this is helpful to you.
Many Thanks for your kindness and help.
HI, thanks for your great work. I want to use the pretrained model on PKL dataset to test a video, how should I do step by step? How to save the model and how to input a video for inference?