配置了cuda环境

modified:   helloworld.py
	modified:   main_windows/main_window.py
	new file:   nst/1.jpg
	modified:   nst/Models.py
master
shawn-sheep 2 years ago
parent 23d27c297a
commit d22d223d6d

@ -1,21 +1,6 @@
import cv2
import torch
def detect_cameras(max_cameras=10):
cameras = []
for i in range(max_cameras):
cap = cv2.VideoCapture(i)
if cap is None or not cap.isOpened():
cap.release()
else:
cameras.append(i)
cap.release()
return cameras
# available_cameras = detect_cameras()
# print(f'Found {len(available_cameras)} camera(s): {available_cameras}'
image = cv2.imread("nst/ori/1.jpg")
cv2.imshow("Image", image)
cv2.waitKey(0)
print(torch.__version__)
use_cuda = torch.cuda.is_available() # 是否有可用的gpu
print(use_cuda)

@ -82,7 +82,7 @@ class MainWindow(QMainWindow):
def pushButton_8(self):
self.sub_window_8_ = sub_window_8.SubWindow()
self.sub_window_8_.show()
def pushButton_10(self):
self.sub_window_10_ = sub_window_10.SubWindow()
self.sub_window_10_.show()

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -296,7 +296,7 @@ if __name__ == "__main__":
# model = models.vgg19(pretrained=True)
ph = "weights/vgg19-dcbb9e9d.pth"
transfer = Transfer("./ori/2.jpg", "./art/2.jpg", ph)
transfer = Transfer("ori/2.jpg", "art/2.jpg", ph)
t = time.time()
dt, img = transfer.fit()

Loading…
Cancel
Save