error: (-2:Unspecified error) could not find a writer for the specified extension in function cv::imwrite    
   '''prediciton using distance'''
for embedding in embeds:
     diff = np.subtract(saved_embeds, embedding)
     dist = np.sum(np.square(diff), 1)
     idx = np.argmin(dist)
     if dist[idx] < threshold:
          predictions.append(names[idx])
          cv2.imwrite(names[idx],frame)
why the image is not saved ?? getting this error :
error: OpenCV(4.3.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-b460jg4o\opencv\modules\imgcodecs\src\loadsave.cpp:667: error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_'
 
 
 
 
what is actually unclear about the error msg to you ?
what is in
names[idx]?(it probably cannot resolve a file extension from there)
You are missing the extension for jpg, png etc for
names[idx]