run_web_visualize.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. CURRENT_DIR=$(cd $(dirname ${BASH_SOURCE[0]});pwd)
  3. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/neuware/lib64/
  4. src_dir="$CURRENT_DIR/../../data"
  5. models_dir="$CURRENT_DIR/../../data/models"
  6. dst_dir="$CURRENT_DIR/src/webui/static"
  7. pushd $dst_dir
  8. if [ ! -d $dst_dir/data ]; then
  9. echo "generate source data"
  10. mkdir data
  11. cp $src_dir/videos/cars.mp4 data/
  12. cp $src_dir/videos/1080P.h264 data/
  13. else
  14. if [ ! -f $dst_dir/data/cars.mp4 ]; then
  15. echo "copy cars.mp4"
  16. cp $src_dir/videos/cars.mp4 data/
  17. fi
  18. if [ ! -f $dst_dir/data/1080P.h264 ]; then
  19. echo "copy 1080P.h264"
  20. cp $src_dir/videos/1080P.h264 data/
  21. fi
  22. fi
  23. pushd $models_dir
  24. resnet50_model_name="resnet50_b16c16_bgra_mlu270.cambricon"
  25. resnet50_label_name="synset_words.txt"
  26. if [ ! -f $resnet50_model_name ]; then
  27. echo "download renset50"
  28. wget -O $resnet50_model_name http://video.cambricon.com/models/MLU270/Classification/resnet50/resnet50_offline_v1.3.0.cambricon
  29. fi
  30. if [ ! -f $resnet50_label_name ]; then
  31. echo "download renset50 label"
  32. wget -O $resnet50_label_name http://video.cambricon.com/models/MLU270/Classification/resnet50/synset_words.txt
  33. fi
  34. ssd_model_name="resnet34_ssd_b16c16_mlu270.cambricon"
  35. ssd_label_name="label_voc.txt"
  36. if [ ! -f $ssd_model_name ]; then
  37. echo "download ssd"
  38. wget -O $ssd_model_name http://video.cambricon.com/models/MLU270/Primary_Detector/ssd/resnet34_ssd.cambricon
  39. fi
  40. if [ ! -f $ssd_label_name ]; then
  41. echo "download ssd label"
  42. wget -O $ssd_label_name http://video.cambricon.com/models/MLU270/Primary_Detector/ssd/label_voc.txt
  43. fi
  44. yolov3_model_name="yolov3_b4c4_argb_mlu270.cambricon"
  45. yolov3_label_name="label_map_coco.txt"
  46. if [ ! -f $yolov3_model_name ]; then
  47. echo "download yolov3"
  48. wget -O $yolov3_model_name http://video.cambricon.com/models/MLU270/yolov3/yolov3_4c4b_argb_270_v1.5.0.cambricon
  49. fi
  50. if [ ! -f $yolov3_label_name ]; then
  51. echo "download yolov3 label"
  52. wget -O $yolov3_label_name http://video.cambricon.com/models/MLU270/yolov3/label_map_coco.txt
  53. fi
  54. feature_extract_model_name="feature_extract_for_tracker_b4c4_argb_mlu270.cambricon"
  55. if [ ! -f $feature_extract_model_name ]; then
  56. echo "download feature extract model"
  57. wget -O $feature_extract_model_name http://video.cambricon.com/models/MLU270/feature_extract/feature_extract_4c4b_argb_270_v1.5.0.cambricon
  58. fi
  59. popd
  60. pushd $dst_dir
  61. if [ -d "models" ]; then
  62. rm -rf "models"
  63. fi
  64. ln -s $src_dir"/models" .
  65. popd
  66. popd
  67. start_webserver() {
  68. pushd src
  69. gunicorn -c ../webserver_config.py wsgi:app
  70. popd
  71. }
  72. start_webserver