car_cf.py 833 B

123456789101112131415161718192021222324252627282930313233343536
  1. import cv2
  2. import time
  3. import os
  4. import requests
  5. import pdb
  6. import asyncio
  7. import websockets
  8. import json
  9. import threading
  10. def car_classification(file_path):
  11. car_dict = {
  12. 0: "tank",
  13. 1: "zhuangjc",
  14. 2: "jiefc",
  15. 3: "lvdc",
  16. 4: "lunsc",
  17. 5: "daodc"
  18. }
  19. file_format = ["txt", "npy", "xls", "wav", "json"]
  20. if file_path.split(".")[-1] in file_format:
  21. class_index = 0
  22. i = int(class_index)
  23. car_name = car_dict[i]
  24. status = True
  25. else:
  26. status = False
  27. direction = 'null'
  28. return (status, car_name,direction)
  29. if __name__ == "__main__":
  30. file_path = 'D:\\Desktop\小组\\声音项目_wx\\数据\\1\\2.txt'
  31. result = car_classification(file_path)
  32. print('-----------done----------',result)