{"id":18472966,"url":"https://github.com/physicsx/facedetection-yolo4-jetsonnano","last_synced_at":"2026-03-19T04:35:55.691Z","repository":{"id":50525120,"uuid":"479528058","full_name":"PhysicsX/FaceDetection-YOLO4-jetsonNano","owner":"PhysicsX","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-04T13:12:16.000Z","size":46076,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T23:23:55.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhysicsX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-08T20:22:42.000Z","updated_at":"2024-08-29T18:22:21.000Z","dependencies_parsed_at":"2023-02-09T22:45:17.542Z","dependency_job_id":null,"html_url":"https://github.com/PhysicsX/FaceDetection-YOLO4-jetsonNano","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PhysicsX/FaceDetection-YOLO4-jetsonNano","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhysicsX%2FFaceDetection-YOLO4-jetsonNano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhysicsX%2FFaceDetection-YOLO4-jetsonNano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhysicsX%2FFaceDetection-YOLO4-jetsonNano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhysicsX%2FFaceDetection-YOLO4-jetsonNano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhysicsX","download_url":"https://codeload.github.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhysicsX%2FFaceDetection-YOLO4-jetsonNano/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28733299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T17:51:25.893Z","status":"ssl_error","status_checked_at":"2026-01-24T17:50:48.377Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T10:23:12.083Z","updated_at":"2026-01-24T18:01:51.175Z","avatar_url":"https://github.com/PhysicsX.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Detection example with YOLO4 on Jetson Nano\n\nThis example is tested with ubuntu\n```bash\nDistributor ID: Ubuntu\nDescription:    Ubuntu 18.04.6 LTS\nRelease:        18.04\nCodename:       bionic\n```\nTested jetpack version\n```bash\nulas@ulas:~$ sudo apt-cache show nvidia-jetpack\n[sudo] password for ulas:\nPackage: nvidia-jetpack\nVersion: 4.6-b199\nArchitecture: arm64\nMaintainer: NVIDIA Corporation\nInstalled-Size: 194\nDepends: nvidia-cuda (= 4.6-b199), nvidia-opencv (= 4.6-b199), nvidia-cudnn8 (= 4.6-b199), nvidia-tensorrt (= 4.6-b199), nvidia-visionworks (= 4.6-b199), nvidia-container (= 4.6-b199), nvidia-vpi (= 4.6-b199), nvidia-l4t-jetson-multimedia-api (\u003e\u003e 32.6-0), nvidia-l4t-jetson-multimedia-api (\u003c\u003c 32.7-0)\nHomepage: http://developer.nvidia.com/jetson\nPriority: standard\nSection: metapackages\nFilename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6-b199_arm64.deb\nSize: 29368\nSHA256: 69df11e22e2c8406fe281fe6fc27c7d40a13ed668e508a592a6785d40ea71669\nSHA1: 5c678b8762acc54f85b4334f92d9bb084858907a\nMD5sum: 1b96cd72f2a434e887f98912061d8cfb\nDescription: NVIDIA Jetpack Meta Package\nDescription-md5: ad1462289bdbc54909ae109d1d32c0a8\n\nPackage: nvidia-jetpack\nVersion: 4.6-b197\nArchitecture: arm64\nMaintainer: NVIDIA Corporation\nInstalled-Size: 194\nDepends: nvidia-cuda (= 4.6-b197), nvidia-opencv (= 4.6-b197), nvidia-cudnn8 (= 4.6-b197), nvidia-tensorrt (= 4.6-b197), nvidia-visionworks (= 4.6-b197), nvidia-container (= 4.6-b197), nvidia-vpi (= 4.6-b197), nvidia-l4t-jetson-multimedia-api (\u003e\u003e 32.6-0), nvidia-l4t-jetson-multimedia-api (\u003c\u003c 32.7-0)\nHomepage: http://developer.nvidia.com/jetson\nPriority: standard\nSection: metapackages\nFilename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6-b197_arm64.deb\nSize: 29356\nSHA256: 104cd0c1efefe5865753ec9b0b148a534ffdcc9bae525637c7532b309ed44aa0\nSHA1: 8cca8b9ebb21feafbbd20c2984bd9b329a202624\nMD5sum: 463d4303429f163b97207827965e8fe0\nDescription: NVIDIA Jetpack Meta Package\nDescription-md5: ad1462289bdbc54909ae109d1d32c0a8\n```\n\nDarknet commit number:\n```bash\nulas@ulas:~/darknet$ git log --oneline\n8a0bf84 (HEAD -\u003e master, origin/master, origin/HEAD) various fixes (#8398)\n2c137d1 Fix conv_lstm cuda errors and nan's (#8388)\nb4d03f8 issue #8308: memory leaks in map (#8314)\n```\n\nFirst Darkent should be compiled on the Jetson Nano. Shared objectfile is available in the repo.\nIf you do not want to compile use exactly same versions as described here. Otherwise compile yourself.\n```bash\nexport PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}\nexport LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}\ngit clone https://github.com/AlexeyAB/darknet\n```\nSome parameters should be updated according to used hardware which is nano. You can use the Makefile in this repository as a reference.\nUpdate the Makefile. \n```bash\nGPU=1\nCUDNN=1\nCUDNN_HALF=1\nOPENCV=1\nAVX=0\nOPENMP=1\nLIBSO=1\nZED_CAMERA=0\nZED_CAMERA_v2_8=0\n\nARCH= -gencode arch=compute_53,code=[sm_53,compute_53]\n```\n\n\nThen compile the darknet.\n```bash\nmake\nwget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-csp.weights\nwget https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-csp.cfg\nwget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights\n```\nYou can test it with:\nYou should be in the darknet directory to run these examples:\n```bash\n./darknet detector demo cfg/coco.data cfg/yolov4-csp.cfg yolov4-csp.weights data/dog.jpg -gpus 0\n```\nfor usb camera:\n```bash\n./darknet detector demo cfg/coco.data cfg/yolov4-csp.cfg yolov4-tiny.weights -c 1 -gpus 0\n```\nfor gstreamer ( should be builded or installed )\n```bash\n./darknet detector demo cfg/coco.data cfg/yolov4-csp.cfg yolov4-csp.weights \"nvarguscamerasrc ! video/x-raw(memory:NVMM), width=800, height=480, format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv flip-method=2  ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink\" -gpus 0\n``` \n\nI compiled opencv myself. The version is 4.4.0. If you want to build yourself, use the script to build the opencv. It will delete the old ones. Script is tested on nano only.\n\n## Train the model\nBefore starting the training I created a directory inside the darknet directoy. That means binary is located in one above directory. It does not matter as long as you are able to give the correct paths for images and related configuration files then you can run the binary from wherever you want.\n```bash\nmkdir trainingYolov4 \u0026\u0026 cd trainingYolov4\n```\n\nI used wider face dataset to train the model. Also transfer learning is used.\nInstall the zip files from http://shuoyang1213.me/WIDERFACE/\nunzip them. There are three zip files.\nFirst one is for training. Second one is for validation for the images.\nLast one has the txt files which holds the related position data. But these data should be in the same file with images and with same name. We will handle this later with single python script.\n\n```bash\nunzip ../../drive/MyDrive/WIDER_train.zip\nunzip ../../drive/MyDrive/WIDER_val.zip\nunzip ../../drive/MyDrive/wider_face_split.zip\n```\nAfter this lets create txt file for each picture for yolo.\nBefore start edit the file for absolute paths\nIn the code:\n```bash\ntrain_set_dir = '/content/drive/MyDrive/trainingFace/darknet/trainingYolo/WIDER_train/images'\nval_set_dir = '/content/drive/MyDrive/trainingFace/darknet/trainingYolo/WIDER_val/images'\n\ntrain_gt = '/content/drive/MyDrive/trainingFace/darknet/trainingYolo/wider_face_split/wider_face_train_bbx_gt.txt'\nval_gt = '/content/drive/MyDrive/trainingFace/darknet/trainingYolo/wider_face_split/wider_face_val_bbx_gt.txt\n```\n\n```bash\nwget https://raw.githubusercontent.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/master/make_annotation.py\npython3 make_annotation.py\n```\nAfter this check the each directory for images you will see txt files for each image. Additionaly this script will produce two txt files where you run it. train.txt and val.txt. These txt files have all pictures absolute paths.\nWe will need it in the obj.data file (which is the yolo).\n\nGet related configration files\n```bash\nwget https://raw.githubusercontent.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/master/make_annotation.py\n#check the related part in the darknet repo for this\nwget https://raw.githubusercontent.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/master/yolo/yolov4-tiny-3l.cfg\nwget https://github.com/AlexeyAB/darknet/releases/download/yolov4/yolov4-tiny.conv.29\nwget https://raw.githubusercontent.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/master/yolo/obj.names\nwget https://raw.githubusercontent.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/master/yolo/obj.data\n```\nyolov4-tiny.conv.2 is the training model that we can use it for transfer learning even if it was not trained for our desired object.\n\ncreate a yolo directory and put obj.data, obj.names and cfg file to this directory\n```bash\nmkdir yolo\nmv -t yolo obj.data obj.names yolov4-tiny-3l.cfg\n```\nIn obj.data update the paths for train.txt and val.txt which is produced by the annotayion.py file.\n```bash\ntrain = /content/drive/MyDrive/trainingFace/darknet/trainingYolo/train.txt\nvalid = /content/drive/MyDrive/trainingFace/darknet/trainingYolo/val.txt\n```\nIf you do not run the darknet binary under the darknet directory, during the traning it will look for bakcup directory. So lets create here one.\notherwise training will fail\n```bash\nmkdir backup\n```\nStart training with\n```bash\n./../darknet detector train yolo/obj.data yolo/yolov4-tiny-3l.cfg yolov4-tiny.conv.29 backup\\yolov4-tiny-3l_last.weights -map -dont_show\n```\n\nIf you run these command on colab then be sure GPU is active\n```bash\n!nvidia-smi\n```\n\nYou can check the process from chart.png in the same directory\n\n![](https://github.com/PhysicsX/FaceDetection-YOLO4-jetsonNano/blob/master/chart_yolov4-tiny-3l.png?raw=true)\n\nAlso it is a good idea to check the mAP (Mean Average Precision). (be careful with the paths, below command needs to find train.txt, names.list.)\n```bash\n./darknet detector map /yolo/yolov4-tiny-3l.cfg yolo/yolov4-tiny-3l_last.weights\n```\nAbove command may return something like:\n```bash\nIoU threshold = 50 %, used Area-Under-Curve for each unique Recall\nmean average precision (mAP@0.50) = 0.400207, or 42.02 % \n```\n\n## Run the example with python\nIf examples are working. At least the one for picture. Then we can use python wrappers to call darknet.so file and use desired functions inside the python. \nHere it will be good to use opencv with python. Everything will be more easy.\n\njust run the application with python3.\n```bash\npython3 face_detection.py\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphysicsx%2Ffacedetection-yolo4-jetsonnano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphysicsx%2Ffacedetection-yolo4-jetsonnano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphysicsx%2Ffacedetection-yolo4-jetsonnano/lists"}