Skip to content
/ crime-detection Public template

BADS7203 : IMAGE AND VIDEO ANALYTICS - 2561/2 - Crime Detection Project

Notifications You must be signed in to change notification settings

BADS-NIDA/crime-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 

Repository files navigation

Introduction Crime Detection

  • วิธีการใช้สร้าง Object detection model สำหรับการตรวบจับการก่อเหตุอาชญกรรม ได้แก่การตรวจจับหมวกกันน็อค อาวุธปืน โดยโช้ YOLOv2 เป็นอัลกอริทึมในการทำ detections โดยมี TensorFlow GPU เป็น Backend

รายชื่อ contributors

  1. นายนราชันย์ ปัญญาจักร 61104220029
  2. นายชลัช มงคลถิรภัทร์ 6110422032
  3. นายอติเทพ กิติธีระกุล 6110422047
  4. นายธนา ธารารัตน์พิสัย 6110422054
  5. นายยงยุทธ ละมูลมอญ 6110422055

prayut ezgif com-resize

ezgif com-resize ezgif com-resize (1)

Prepare Environment

  • เตรียมโปรแกรมต่างๆ สำหรับการทำ Crime Detection ใน Project นี้ ด้วยขั้นตอนดังต่อไปนี้

    1. Clone Darkflow Repository

    • เพื่อ build framwork darknet yolo ที่มี tensorflow เป็น backend
       git clone https://github.com/thtrieu/darkflow
      

    2. Clone labelImg Repository

    • เพื่อ สร้าง Label ของ Dataset ที่เป็น Images
       git clone https://github.com/tzutalin/labelImg
      

    3. Install Programs

    4. Install Tensorflow GPU

    • conda create -n mytf python=3.6 anaconda
    • activate mytf
       - pip install opencv-contrib-python
       - pip install tensorflow==1.10.0
       - pip install tensorflow-gpu==1.10.0
       - pip install keras
      

Train Model

  • ขั้นตอนการ train ดาวน์โหลด tiny-yolo-voc weight จาก

     https://drive.google.com/drive/folders/0B1tW_VtY7onidEwyQ2FtQVplWEU
    

    ใส่ใน folder ชื่อ bin (จาก Dark flow Folder Path ที่ทำการ Clone มา)

  • แก้ไขไฟล์ cfg/ tiny-yolo-voc.cfg ใน layer สุดท้าย แก้ node=35 และ class=3 ตั้งชื่อไฟล์ใหม่เป็น tiny-yolo-voc-3c.cfg

  • สร้าง folder train (จาก Dark flow Folder Path ที่ทำการ Clone มา) โดยมี subfolder ชื่อ images สำหรับไฟล์รูป annotations สำหรับ label และ แก้ไข label.txt เป็นชื่อ class ต่างๆ เช่น helmet gun person

  • ทำการ train model ด้วยคำสั่งดังต่อไปนี้

    python flow 
    --model cfg/tiny-yolo-voc-3c.cfg 
    --load bin/tiny-yolo-voc.weights 
    --train --annotation train\annotations 
    --dataset train\images 
    --gpu 0.7 
    --epoch 500
    

Run Crime Detection

  • เมื่อเตรียมข้อมูลทั้งหมดเสร็จแล้ว ทำการทดสอบโปรแกรมเบื้องต้นว่าสามารถทำงานได้ โดยใส่ชื่อไฟล์ video หลัง -- demo

     python flow 
     --model <PATH_CONFIG_FILES> 
     --load <PATH_WEIGHTS_FILES> 
     --demo <PATH_VIDEO_FILES> 
     --gpu 0.8 
     --saveVideo
    

    เช่น

     python flow --model cfg/yolo.cfg --load bin/yolo.weights --demo gun4_2.mp4 --gpu 0.8 --saveVideo
    
  • จากนั้นทำการ download file weights และ ตั้งชื่อ Folder ว่า ckpt พร้อมนำ file เข้าไปวาง

     https://drive.google.com/file/d/1FsABUzIPKLd-_YGkgG-cyBHsdymo8N-8/view
    
  • จากนั้นทำการ run python file read_video.py สำหรับทดสอบการทำงานกับ video file หากต้องการ run บน webcam ก็สามารถทำได้โดย run python file read_cam.py สำหรับทดสอบการทำงานกับ web cam

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages