You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

userdata.sh 1.2 kB

3 years ago
123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # AWS EC2 instance startup script https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
  3. # This script will run only once on first instance start (for a re-start script see mime.sh)
  4. # /home/ubuntu (ubuntu) or /home/ec2-user (amazon-linux) is working dir
  5. # Use >300 GB SSD
  6. cd home/ubuntu
  7. if [ ! -d yolor ]; then
  8. echo "Running first-time script." # install dependencies, download COCO, pull Docker
  9. git clone -b paper https://github.com/WongKinYiu/yolor && sudo chmod -R 777 yolor
  10. cd yolor
  11. bash data/scripts/get_coco.sh && echo "Data done." &
  12. sudo docker pull nvcr.io/nvidia/pytorch:21.08-py3 && echo "Docker done." &
  13. python -m pip install --upgrade pip && pip install -r requirements.txt && python detect.py && echo "Requirements done." &
  14. wait && echo "All tasks done." # finish background tasks
  15. else
  16. echo "Running re-start script." # resume interrupted runs
  17. i=0
  18. list=$(sudo docker ps -qa) # container list i.e. $'one\ntwo\nthree\nfour'
  19. while IFS= read -r id; do
  20. ((i++))
  21. echo "restarting container $i: $id"
  22. sudo docker start $id
  23. # sudo docker exec -it $id python train.py --resume # single-GPU
  24. sudo docker exec -d $id python utils/aws/resume.py # multi-scenario
  25. done <<<"$list"
  26. fi

随着人工智能和大数据的发展,任一方面对自动化工具有着一定的需求,在当下疫情防控期间,使用mindspore来实现yolo模型来进行目标检测及语义分割,对视频或图片都可以进行口罩佩戴检测和行人社交距离检测,来对公共场所的疫情防控来实行自动化管理。