質問編集履歴

2

以前のエラーは自分で解決できたが別のエラーが発生したため編集した

2021/03/19 02:36

投稿

xeno
xeno

スコア16

test CHANGED
@@ -1 +1 @@
1
- FaceSwap実行の際のpathに関連したエラー
1
+ FaceSwap実行の際のType Error
test CHANGED
@@ -1,8 +1,10 @@
1
- FaceSwapをGoogle Colaboratoryで実行したいのですpathが上手く通っていないのか<class 'NoneType'>なってしまいま
1
+ FaceSwapをGoogle Colaboratoryで実行したいのです。以前発生していたpathに関するエラーは解決したのですTypeに関するエラーが解決できせんので編集たしした
2
-
2
+
3
- https://github.com/matthewearl/faceswap/blob/master/faceswap.py このサイトを参考にしています。
3
+ [リンク内容](https://github.com/matthewearl/faceswap/blob/master/faceswap.py) このサイトのコード使用しています。
4
+
4
-
5
+ [リンク内容](https://qiita.com/goodboy_max/items/134f80c2bc8a6d83aa33)このサイトの通りにやっています。
6
+
5
- 下記のコードに追加部分と書いてある部分私が画像がきちんと読み込めていて表示きるかを確認るために追加しました
7
+ コード内のpath関しはコピーしたものなのでっているはです。
6
8
 
7
9
 
8
10
 
@@ -14,21 +16,19 @@
14
16
 
15
17
  import dlib
16
18
 
17
- import numpy as np
19
+ import numpy
20
+
21
+
18
22
 
19
23
  import sys
20
24
 
21
- import matplotlib.pyplot as plt
25
+
22
-
23
-
24
-
25
- !wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
26
+
26
-
27
- !bunzip2 "shape_predictor_68_face_landmarks.dat.bz2"
28
-
29
-
30
-
31
- PREDICTOR_PATH = "./shape_predictor_68_face_landmarks.dat"
27
+ PREDICTOR_PATH = "/content/drive/MyDrive/Colab Notebooks/shape_predictor_68_face_landmarks.dat"
28
+
29
+
30
+
31
+
32
32
 
33
33
  SCALE_FACTOR = 1
34
34
 
@@ -84,9 +84,9 @@
84
84
 
85
85
 
86
86
 
87
- detector = dlib.get_frontal_face_detector()
87
+ detector = dlib.get_frontal_face_detector(PREDICTOR_PATH)
88
-
88
+
89
- predictor = dlib.shape_predictor(PREDICTOR_PATH)
89
+ predictor = dlib.shape_predictor()
90
90
 
91
91
 
92
92
 
@@ -258,22 +258,6 @@
258
258
 
259
259
  im = cv2.imread(fname, cv2.IMREAD_COLOR)
260
260
 
261
-
262
-
263
- #---追加部分---
264
-
265
- print(type(im))
266
-
267
- img_list = np.asarray(im) # 画像を配列に変換
268
-
269
- plt.imshow(img_list) # 貼り付け
270
-
271
- plt.show() # 表示
272
-
273
- #---end---
274
-
275
-
276
-
277
261
  im = cv2.resize(im, (im.shape[1] * SCALE_FACTOR,
278
262
 
279
263
  im.shape[0] * SCALE_FACTOR))
@@ -380,72 +364,28 @@
380
364
 
381
365
  ```
382
366
 
383
- --2021-03-09 10:31:32-- http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
384
-
385
- Resolving dlib.net (dlib.net)... 107.180.26.78
386
-
387
- Connecting to dlib.net (dlib.net)|107.180.26.78|:80... connected.
388
-
389
- HTTP request sent, awaiting response... 200 OK
390
-
391
- Length: 64040097 (61M)
392
-
393
- Saving to: ‘shape_predictor_68_face_landmarks.dat.bz2’
394
-
395
-
396
-
397
- shape_predictor_68_ 100%[===================>] 61.07M 7.39MB/s in 14s
398
-
399
-
400
-
401
- 2021-03-09 10:31:47 (4.26 MB/s) - ‘shape_predictor_68_face_landmarks.dat.bz2’ saved [64040097/64040097]
402
-
403
-
404
-
405
- <class 'NoneType'>
406
-
407
- ---------------------------------------------------------------------------
408
-
409
367
  TypeError Traceback (most recent call last)
410
368
 
411
- <ipython-input-1-a235536e2913> in <module>()
369
+ <ipython-input-10-1ac12538b634> in <module>()
412
-
370
+
413
- 160 im2_blur.astype(numpy.float64))
371
+ 35 COLOUR_CORRECT_BLUR_FRAC = 0.6
414
-
372
+
415
- 161
373
+ 36
416
-
374
+
417
- --> 162 im1, landmarks1 = read_im_and_landmarks(sys.argv[1])
375
+ ---> 37 detector = dlib.get_frontal_face_detector(PREDICTOR_PATH)
418
-
376
+
419
- 163 im2, landmarks2 = read_im_and_landmarks(sys.argv[2])
377
+ 38 predictor = dlib.shape_predictor()
420
-
378
+
421
- 164
379
+ 39
422
-
423
-
424
-
380
+
381
+
382
+
425
- 6 frames
383
+ TypeError: get_frontal_face_detector(): incompatible function arguments. The following argument types are supported:
384
+
426
-
385
+ 1. () -> dlib::object_detector<dlib::scan_fhog_pyramid<dlib::pyramid_down<6u>, dlib::default_fhog_feature_extractor> >
386
+
387
+
388
+
427
- /usr/local/lib/python3.7/dist-packages/matplotlib/image.py in set_data(self, A)
389
+ Invoked with: '/content/drive/MyDrive/Colab Notebooks/shape_predictor_68_face_landmarks.dat'
428
-
429
- 692 not np.can_cast(self._A.dtype, float, "same_kind")):
430
-
431
- 693 raise TypeError("Image data of dtype {} cannot be converted to "
432
-
433
- --> 694 "float".format(self._A.dtype))
434
-
435
- 695
436
-
437
- 696 if not (self._A.ndim == 2
438
-
439
-
440
-
441
- TypeError: Image data of dtype object cannot be converted to float
442
390
 
443
391
  ```
444
-
445
-
446
-
447
- Colabo notebooksの状況は以下写真のようになっています。
448
-
449
- プログラムの名前はUntitled10です。
450
-
451
- ![イメージ説明](9832523a9e397bc09d3b8b10418d8f3a.png)

1

言語を記入した

2021/03/19 02:36

投稿

xeno
xeno

スコア16

test CHANGED
File without changes
test CHANGED
File without changes