fix warning in 'mp42' video encoder

This commit is contained in:
ken4647 2022-12-03 21:56:39 +08:00
parent e3781e789a
commit e8b71de1e1
2 changed files with 6 additions and 4 deletions

4
.gitignore vendored
View File

@ -5,4 +5,6 @@
*.mp4
*.t7
*.pth
*label*
*label*
result.txt
rank10_detection.txt

View File

@ -72,7 +72,7 @@ if __name__ == '__main__':
query_path = f"./mydataset/query/cam{my_option.query_index}/" # query from .jpg photos
gallary_path = f"mydataset/video/cam{my_option.gallary_index}.mp4" # source from mp4 via yolo
output_video_path = f"output/output{my_option.gallary_index}_{my_option.query_index}.mp4" # output file path
output_txt_path = f"output/rank10_detection.txt"
output_txt_path = f"output/rank10_detection_{my_option.gallary_index}_{my_option.query_index}.txt"
query_features = []
paths = os.listdir(query_path)
@ -89,7 +89,7 @@ if __name__ == '__main__':
with torch.no_grad():
sources = cv2.VideoCapture(gallary_path)
target = cv2.VideoWriter(output_video_path,cv2.VideoWriter_fourcc('m', 'p', '4', '2'),24,(1920,1080))
target = cv2.VideoWriter(output_video_path,cv2.VideoWriter_fourcc('m', 'p', '4', 'v'),24,(1920,1080))
frame_counter = 0
while True:
ret,frame = sources.read()
@ -130,7 +130,7 @@ if __name__ == '__main__':
for distance in feature_distances_sorted:
if distance < DISTANCE_THRESHOLD:
index_d = feature_distances.index(distance)
query_match_buff[index_d].append((MOT_id,distance,(frame_counter,track[0],track[1],track[2],track[3]))) # dpsort[-1]: id in MOT
query_match_buff[index_d].append((MOT_id,distance,(frame_counter,track[0],track[1],track[2],track[3])))
query_match_buff[index_d].sort(key=lambda x:x[1],reverse=True)
if len(query_match_buff[index_d]) > MAX_BUFFLEN:
query_match_buff[index_d].pop()