Ho Chi Minh City University of Technology - Control Engineering and Automation
- Nguyen Ngoc Nhan
- Thai Quang Nguyen
- Pham Ngoc Tran
- Nguyen Gia Khiem
- Pham Binh Nguyen
Link: https://youtu.be/4DhUrMDltvE
Check out this link: https://youtu.be/ZRC2nzP1w_4
- Open anaconda terminal, navigate to your directory
- Run this command to clone the code:
git clone [email protected]:khiemnguyen240900/vnese-id-extractor.git
- Then navigate to the code
cd vnese-id-extractor
- Create conda environment with cpu or gpu
# Change directory to installation
cd installation
# for CPU
conda env create -f conda-cpu.yml
conda activate yolov4-cpu
# for GPU
conda env create -f conda-gpu.yml
conda activate yolov4-gpu
- Install requirements
# for CPU
pip install -r requirements.txt
# for GPU
pip install -r requirements-gpu.txt
- Back to the base folder
cd ..
- Download my pre-trained weights at: https://drive.google.com/drive/folders/1TwrMzlOS2HuOv628ZOQeqANTQRpUapwh?usp=sharing
- Put the weights file into: ./yolov4_card_detection/data/
- Put the names file into: ./yolov4_card_detection/data/classes/
- Open ./yolov4_card_detection/core/config.py, change line 15 to
__C.YOLO.BASE = os.getcwd().replace(os.sep, '/')
- Convert the Yolo weights from darknet to tensorflow
cd yolov4_card_detection
python save_model.py --weights ./data/yolov4-cards.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4
cd ..
- Ensure the conversion is successful by checking ./yolov4_card_detection/checkpoints folder
- Undo step 4.4 (change line 15 back to)
__C.YOLO.BASE = os.getcwd().replace(os.sep, '/') + "/yolov4_card_detection"
- Note: to train with your custom data, check out this tutorial from theAIguys: https://youtu.be/mmj3nxGT2YQ
- Please read Appendix A for information about flags
- Run the following code (make sure you are in the base folder)
# using webcam with interactive mode
python main.py --weights /checkpoints/custom-416 --video 0 --interactive
# using phone camera through IP Webcam app and save the aligned image
python main.py --weights /checkpoints/custom-416 --camera_ip "YOUR-CAMERA-IP" --output
- Extracted information and aligned image will be store in ./output folder
--alignment_process: show alignment process (default: 'false')
--camera_ip: camera ip for external camera
--interactive: interactive mode in card alignment (default: 'false')
--output: to save aligned image to output folder (default: 'false')
--video: path to input video or set to 0 for webcam (default: '0')
--weights: path to weights file (default: '/checkpoints/yolov4-416')
Other flags such as --iou, --model, --size,... can be read by running this command
python main.py --helpshort