JeungEunLee

data augmentated and size/rotate experiment : because output looks folded

...@@ -33,12 +33,27 @@ ...@@ -33,12 +33,27 @@
33 " image_channels = 3\n", 33 " image_channels = 3\n",
34 " self.data_files = data_files\n", 34 " self.data_files = data_files\n",
35 " self.shape = len(data_files), IMAGE_WIDTH, IMAGE_HEIGHT, image_channels\n", 35 " self.shape = len(data_files), IMAGE_WIDTH, IMAGE_HEIGHT, image_channels\n",
36 + " \n",
37 + " def get_image(iself,image_path, width, height, mode):\n",
38 + " image = Image.open(image_path)\n",
39 + " image = image.resize((width,height))\n",
40 + " return np.array(image)\n",
41 + "\n",
42 + "\n",
43 + " def get_batch(self,image_files, width, height, mode):\n",
44 + " data_batch = np.array(\n",
45 + " [self.get_image(sample_file, width, height, mode) for sample_file in image_files]).astype(np.float32)\n",
46 + " \n",
47 + " # Make sure the images are in 4 dimensions\n",
48 + " if len(data_batch.shape) < 4:\n",
49 + " data_batch = data_batch.reshape(data_batch.shape + (1,))\n",
50 + " return data_batch\n",
36 "\n", 51 "\n",
37 " def get_batches(self, batch_size):\n", 52 " def get_batches(self, batch_size):\n",
38 " IMAGE_MAX_VALUE = 255\n", 53 " IMAGE_MAX_VALUE = 255\n",
39 " current_index = 0\n", 54 " current_index = 0\n",
40 " while current_index + batch_size <= self.shape[0]:\n", 55 " while current_index + batch_size <= self.shape[0]:\n",
41 - " data_batch = get_batch(\n", 56 + " data_batch = self.get_batch(\n",
42 " self.data_files[current_index:current_index + batch_size],\n", 57 " self.data_files[current_index:current_index + batch_size],\n",
43 " self.shape[1],self.shape[2],\n", 58 " self.shape[1],self.shape[2],\n",
44 " self.image_mode)\n", 59 " self.image_mode)\n",
...@@ -219,10 +234,14 @@ ...@@ -219,10 +234,14 @@
219 " saver = tf.train.Saver()\n", 234 " saver = tf.train.Saver()\n",
220 " sess.run(tf.global_variables_initializer())\n", 235 " sess.run(tf.global_variables_initializer())\n",
221 " \n", 236 " \n",
222 - " # continue training\n", 237 + " # continue training\n",
223 " save_path = saver.save(sess, \"/tmp/model.ckpt\")\n", 238 " save_path = saver.save(sess, \"/tmp/model.ckpt\")\n",
224 " ckpt = tf.train.latest_checkpoint('./model/')\n", 239 " ckpt = tf.train.latest_checkpoint('./model/')\n",
225 " saver.restore(sess, save_path)\n", 240 " saver.restore(sess, save_path)\n",
241 + " \n",
242 + " #newsaver = tf.train.import_meta_graph('./model/70.meta')\n",
243 + " #newsaver.restore(sess, tf.train.latest_checkpoint('./model/'))\n",
244 + " \n",
226 " coord = tf.train.Coordinator()\n", 245 " coord = tf.train.Coordinator()\n",
227 " threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n", 246 " threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n",
228 "\n", 247 "\n",
...@@ -280,36 +299,388 @@ ...@@ -280,36 +299,388 @@
280 "name": "stdout", 299 "name": "stdout",
281 "output_type": "stream", 300 "output_type": "stream",
282 "text": [ 301 "text": [
283 - "140\n", 302 + "5004\n",
303 + "(?, 4, 4, 1024)\n",
304 + "(?, 6, 6, 512)\n",
305 + "(?, 12, 12, 256)\n",
306 + "(?, 25, 25, 3)\n",
307 + "INFO:tensorflow:Restoring parameters from /tmp/model.ckpt\n",
308 + "Epoch 1/200 Step 10... Discriminator Loss: 0.7986... Generator Loss: 2.7782\n",
309 + "(?, 4, 4, 1024)\n",
310 + "(?, 6, 6, 512)\n",
311 + "(?, 12, 12, 256)\n",
312 + "(?, 25, 25, 3)\n",
313 + "Epoch 2/200 Step 20... Discriminator Loss: 0.7019... Generator Loss: 1.2096\n",
314 + "(?, 4, 4, 1024)\n",
315 + "(?, 6, 6, 512)\n",
316 + "(?, 12, 12, 256)\n",
317 + "(?, 25, 25, 3)\n",
318 + "Epoch 2/200 Step 30... Discriminator Loss: 0.6407... Generator Loss: 1.7675\n",
319 + "(?, 4, 4, 1024)\n",
320 + "(?, 6, 6, 512)\n",
321 + "(?, 12, 12, 256)\n",
322 + "(?, 25, 25, 3)\n",
323 + "Epoch 3/200 Step 40... Discriminator Loss: 0.9732... Generator Loss: 0.9018\n",
324 + "(?, 4, 4, 1024)\n",
325 + "(?, 6, 6, 512)\n",
326 + "(?, 12, 12, 256)\n",
327 + "(?, 25, 25, 3)\n",
328 + "Epoch 3/200 Step 50... Discriminator Loss: 1.2455... Generator Loss: 2.2003\n",
329 + "(?, 4, 4, 1024)\n",
330 + "(?, 6, 6, 512)\n",
331 + "(?, 12, 12, 256)\n",
332 + "(?, 25, 25, 3)\n",
333 + "Epoch 4/200 Step 60... Discriminator Loss: 0.9650... Generator Loss: 1.1981\n",
334 + "(?, 4, 4, 1024)\n",
335 + "(?, 6, 6, 512)\n",
336 + "(?, 12, 12, 256)\n",
337 + "(?, 25, 25, 3)\n",
338 + "Epoch 4/200 Step 70... Discriminator Loss: 0.9376... Generator Loss: 1.6022\n",
339 + "(?, 4, 4, 1024)\n",
340 + "(?, 6, 6, 512)\n",
341 + "(?, 12, 12, 256)\n",
342 + "(?, 25, 25, 3)\n",
343 + "Epoch 5/200 Step 80... Discriminator Loss: 0.9873... Generator Loss: 0.9408\n",
344 + "(?, 4, 4, 1024)\n",
345 + "(?, 6, 6, 512)\n",
346 + "(?, 12, 12, 256)\n",
347 + "(?, 25, 25, 3)\n",
348 + "Epoch 5/200 Step 90... Discriminator Loss: 1.1370... Generator Loss: 2.2449\n",
349 + "(?, 4, 4, 1024)\n",
350 + "(?, 6, 6, 512)\n",
351 + "(?, 12, 12, 256)\n",
352 + "(?, 25, 25, 3)\n",
353 + "Epoch 6/200 Step 100... Discriminator Loss: 0.9307... Generator Loss: 1.1019\n",
354 + "(?, 4, 4, 1024)\n",
355 + "(?, 6, 6, 512)\n",
356 + "(?, 12, 12, 256)\n",
357 + "(?, 25, 25, 3)\n",
358 + "Epoch 6/200 Step 110... Discriminator Loss: 0.9045... Generator Loss: 1.3023\n",
359 + "(?, 4, 4, 1024)\n",
360 + "(?, 6, 6, 512)\n",
361 + "(?, 12, 12, 256)\n",
362 + "(?, 25, 25, 3)\n",
363 + "Epoch 7/200 Step 120... Discriminator Loss: 1.4306... Generator Loss: 3.0811\n",
364 + "(?, 4, 4, 1024)\n",
365 + "(?, 6, 6, 512)\n",
366 + "(?, 12, 12, 256)\n",
367 + "(?, 25, 25, 3)\n",
368 + "Epoch 7/200 Step 130... Discriminator Loss: 0.8306... Generator Loss: 1.4418\n",
369 + "(?, 4, 4, 1024)\n",
370 + "(?, 6, 6, 512)\n",
371 + "(?, 12, 12, 256)\n",
372 + "(?, 25, 25, 3)\n",
373 + "Epoch 8/200 Step 140... Discriminator Loss: 1.0130... Generator Loss: 0.9772\n",
374 + "(?, 4, 4, 1024)\n",
375 + "(?, 6, 6, 512)\n",
376 + "(?, 12, 12, 256)\n",
377 + "(?, 25, 25, 3)\n",
378 + "Epoch 8/200 Step 150... Discriminator Loss: 1.1253... Generator Loss: 2.7651\n",
379 + "(?, 4, 4, 1024)\n",
380 + "(?, 6, 6, 512)\n",
381 + "(?, 12, 12, 256)\n",
382 + "(?, 25, 25, 3)\n",
383 + "Epoch 9/200 Step 160... Discriminator Loss: 1.2028... Generator Loss: 0.5614\n",
384 + "(?, 4, 4, 1024)\n",
385 + "(?, 6, 6, 512)\n",
386 + "(?, 12, 12, 256)\n",
387 + "(?, 25, 25, 3)\n",
388 + "Epoch 9/200 Step 170... Discriminator Loss: 1.1864... Generator Loss: 0.6131\n",
389 + "(?, 4, 4, 1024)\n",
390 + "(?, 6, 6, 512)\n",
391 + "(?, 12, 12, 256)\n",
392 + "(?, 25, 25, 3)\n",
393 + "Epoch 10/200 Step 180... Discriminator Loss: 0.8613... Generator Loss: 1.1399\n",
394 + "(?, 4, 4, 1024)\n",
395 + "(?, 6, 6, 512)\n",
396 + "(?, 12, 12, 256)\n",
397 + "(?, 25, 25, 3)\n",
398 + "Epoch 10/200 Step 190... Discriminator Loss: 0.7570... Generator Loss: 1.9568\n",
399 + "(?, 4, 4, 1024)\n",
400 + "(?, 6, 6, 512)\n",
401 + "(?, 12, 12, 256)\n",
402 + "(?, 25, 25, 3)\n",
403 + "Epoch 11/200 Step 200... Discriminator Loss: 0.8872... Generator Loss: 1.3420\n",
404 + "(?, 4, 4, 1024)\n",
405 + "(?, 6, 6, 512)\n",
406 + "(?, 12, 12, 256)\n",
407 + "(?, 25, 25, 3)\n",
408 + "Epoch 12/200 Step 210... Discriminator Loss: 0.7758... Generator Loss: 1.3705\n",
409 + "(?, 4, 4, 1024)\n",
410 + "(?, 6, 6, 512)\n",
411 + "(?, 12, 12, 256)\n",
412 + "(?, 25, 25, 3)\n",
413 + "Epoch 12/200 Step 220... Discriminator Loss: 0.9375... Generator Loss: 2.3697\n",
414 + "(?, 4, 4, 1024)\n",
415 + "(?, 6, 6, 512)\n",
416 + "(?, 12, 12, 256)\n",
417 + "(?, 25, 25, 3)\n",
418 + "Epoch 13/200 Step 230... Discriminator Loss: 1.0274... Generator Loss: 2.6057\n",
419 + "(?, 4, 4, 1024)\n",
420 + "(?, 6, 6, 512)\n",
421 + "(?, 12, 12, 256)\n",
422 + "(?, 25, 25, 3)\n",
423 + "Epoch 13/200 Step 240... Discriminator Loss: 0.8219... Generator Loss: 1.2095\n",
424 + "(?, 4, 4, 1024)\n",
425 + "(?, 6, 6, 512)\n",
426 + "(?, 12, 12, 256)\n",
427 + "(?, 25, 25, 3)\n",
428 + "Epoch 14/200 Step 250... Discriminator Loss: 0.8607... Generator Loss: 1.8890\n",
429 + "(?, 4, 4, 1024)\n",
430 + "(?, 6, 6, 512)\n",
431 + "(?, 12, 12, 256)\n",
432 + "(?, 25, 25, 3)\n",
433 + "Epoch 14/200 Step 260... Discriminator Loss: 0.8661... Generator Loss: 1.4806\n",
434 + "(?, 4, 4, 1024)\n",
435 + "(?, 6, 6, 512)\n",
436 + "(?, 12, 12, 256)\n",
437 + "(?, 25, 25, 3)\n",
438 + "Epoch 15/200 Step 270... Discriminator Loss: 0.8005... Generator Loss: 1.6766\n",
439 + "(?, 4, 4, 1024)\n",
440 + "(?, 6, 6, 512)\n",
441 + "(?, 12, 12, 256)\n",
442 + "(?, 25, 25, 3)\n",
443 + "Epoch 15/200 Step 280... Discriminator Loss: 0.8658... Generator Loss: 1.6609\n",
444 + "(?, 4, 4, 1024)\n",
445 + "(?, 6, 6, 512)\n",
446 + "(?, 12, 12, 256)\n",
447 + "(?, 25, 25, 3)\n",
448 + "Epoch 16/200 Step 290... Discriminator Loss: 1.3357... Generator Loss: 0.5010\n",
449 + "(?, 4, 4, 1024)\n",
450 + "(?, 6, 6, 512)\n",
451 + "(?, 12, 12, 256)\n",
452 + "(?, 25, 25, 3)\n",
453 + "Epoch 16/200 Step 300... Discriminator Loss: 0.8518... Generator Loss: 1.4408\n",
454 + "(?, 4, 4, 1024)\n",
455 + "(?, 6, 6, 512)\n",
456 + "(?, 12, 12, 256)\n",
457 + "(?, 25, 25, 3)\n",
458 + "Epoch 17/200 Step 310... Discriminator Loss: 0.9052... Generator Loss: 1.2558\n",
459 + "(?, 4, 4, 1024)\n",
460 + "(?, 6, 6, 512)\n",
461 + "(?, 12, 12, 256)\n",
462 + "(?, 25, 25, 3)\n",
463 + "Epoch 17/200 Step 320... Discriminator Loss: 0.9011... Generator Loss: 1.2468\n",
464 + "(?, 4, 4, 1024)\n",
465 + "(?, 6, 6, 512)\n",
466 + "(?, 12, 12, 256)\n",
467 + "(?, 25, 25, 3)\n",
468 + "Epoch 18/200 Step 330... Discriminator Loss: 0.9880... Generator Loss: 0.8800\n",
469 + "(?, 4, 4, 1024)\n",
470 + "(?, 6, 6, 512)\n",
471 + "(?, 12, 12, 256)\n",
472 + "(?, 25, 25, 3)\n",
473 + "Epoch 18/200 Step 340... Discriminator Loss: 0.9066... Generator Loss: 2.0460\n",
474 + "(?, 4, 4, 1024)\n",
475 + "(?, 6, 6, 512)\n",
476 + "(?, 12, 12, 256)\n",
477 + "(?, 25, 25, 3)\n",
478 + "Epoch 19/200 Step 350... Discriminator Loss: 0.9169... Generator Loss: 1.7369\n",
479 + "(?, 4, 4, 1024)\n",
480 + "(?, 6, 6, 512)\n",
481 + "(?, 12, 12, 256)\n",
482 + "(?, 25, 25, 3)\n",
483 + "Epoch 19/200 Step 360... Discriminator Loss: 0.9111... Generator Loss: 1.5251\n",
484 + "(?, 4, 4, 1024)\n",
485 + "(?, 6, 6, 512)\n",
486 + "(?, 12, 12, 256)\n",
487 + "(?, 25, 25, 3)\n",
488 + "Epoch 20/200 Step 370... Discriminator Loss: 0.9466... Generator Loss: 1.0476\n",
489 + "(?, 4, 4, 1024)\n",
490 + "(?, 6, 6, 512)\n",
491 + "(?, 12, 12, 256)\n",
492 + "(?, 25, 25, 3)\n",
493 + "Epoch 20/200 Step 380... Discriminator Loss: 1.0600... Generator Loss: 1.6264\n",
494 + "(?, 4, 4, 1024)\n",
495 + "(?, 6, 6, 512)\n",
496 + "(?, 12, 12, 256)\n",
497 + "(?, 25, 25, 3)\n",
498 + "Epoch 21/200 Step 390... Discriminator Loss: 1.1503... Generator Loss: 0.9095\n",
499 + "(?, 4, 4, 1024)\n",
500 + "(?, 6, 6, 512)\n",
501 + "(?, 12, 12, 256)\n",
502 + "(?, 25, 25, 3)\n",
503 + "Epoch 22/200 Step 400... Discriminator Loss: 1.1989... Generator Loss: 1.2204\n",
504 + "(?, 4, 4, 1024)\n",
505 + "(?, 6, 6, 512)\n",
506 + "(?, 12, 12, 256)\n",
507 + "(?, 25, 25, 3)\n",
508 + "Epoch 22/200 Step 410... Discriminator Loss: 1.1530... Generator Loss: 0.8920\n",
509 + "(?, 4, 4, 1024)\n",
510 + "(?, 6, 6, 512)\n",
511 + "(?, 12, 12, 256)\n",
512 + "(?, 25, 25, 3)\n",
513 + "Epoch 23/200 Step 420... Discriminator Loss: 1.2206... Generator Loss: 0.8665\n",
514 + "(?, 4, 4, 1024)\n",
515 + "(?, 6, 6, 512)\n",
516 + "(?, 12, 12, 256)\n",
517 + "(?, 25, 25, 3)\n",
518 + "Epoch 23/200 Step 430... Discriminator Loss: 1.1357... Generator Loss: 1.0771\n",
519 + "(?, 4, 4, 1024)\n",
520 + "(?, 6, 6, 512)\n",
521 + "(?, 12, 12, 256)\n",
522 + "(?, 25, 25, 3)\n",
523 + "Epoch 24/200 Step 440... Discriminator Loss: 1.5018... Generator Loss: 0.4140\n",
524 + "(?, 4, 4, 1024)\n",
525 + "(?, 6, 6, 512)\n",
526 + "(?, 12, 12, 256)\n",
527 + "(?, 25, 25, 3)\n",
528 + "Epoch 24/200 Step 450... Discriminator Loss: 1.1407... Generator Loss: 0.9182\n",
529 + "(?, 4, 4, 1024)\n",
530 + "(?, 6, 6, 512)\n",
531 + "(?, 12, 12, 256)\n",
532 + "(?, 25, 25, 3)\n",
533 + "Epoch 25/200 Step 460... Discriminator Loss: 1.1208... Generator Loss: 1.0497\n",
534 + "(?, 4, 4, 1024)\n",
535 + "(?, 6, 6, 512)\n",
536 + "(?, 12, 12, 256)\n",
537 + "(?, 25, 25, 3)\n",
538 + "Epoch 25/200 Step 470... Discriminator Loss: 1.2283... Generator Loss: 1.3409\n",
539 + "(?, 4, 4, 1024)\n",
540 + "(?, 6, 6, 512)\n",
541 + "(?, 12, 12, 256)\n",
542 + "(?, 25, 25, 3)\n",
543 + "Epoch 26/200 Step 480... Discriminator Loss: 1.1401... Generator Loss: 0.8807\n",
544 + "(?, 4, 4, 1024)\n",
545 + "(?, 6, 6, 512)\n",
546 + "(?, 12, 12, 256)\n",
547 + "(?, 25, 25, 3)\n",
548 + "Epoch 26/200 Step 490... Discriminator Loss: 1.1839... Generator Loss: 0.7198\n",
549 + "(?, 4, 4, 1024)\n",
550 + "(?, 6, 6, 512)\n",
551 + "(?, 12, 12, 256)\n",
552 + "(?, 25, 25, 3)\n",
553 + "Epoch 27/200 Step 500... Discriminator Loss: 1.5919... Generator Loss: 0.3560\n",
554 + "(?, 4, 4, 1024)\n",
555 + "(?, 6, 6, 512)\n",
556 + "(?, 12, 12, 256)\n",
557 + "(?, 25, 25, 3)\n",
558 + "Epoch 27/200 Step 510... Discriminator Loss: 1.2166... Generator Loss: 1.4234\n",
559 + "(?, 4, 4, 1024)\n",
560 + "(?, 6, 6, 512)\n",
561 + "(?, 12, 12, 256)\n",
562 + "(?, 25, 25, 3)\n",
563 + "Epoch 28/200 Step 520... Discriminator Loss: 1.1838... Generator Loss: 1.2357\n",
564 + "(?, 4, 4, 1024)\n",
565 + "(?, 6, 6, 512)\n",
566 + "(?, 12, 12, 256)\n",
567 + "(?, 25, 25, 3)\n",
568 + "Epoch 28/200 Step 530... Discriminator Loss: 1.2062... Generator Loss: 1.4508\n",
569 + "(?, 4, 4, 1024)\n",
570 + "(?, 6, 6, 512)\n",
571 + "(?, 12, 12, 256)\n",
572 + "(?, 25, 25, 3)\n",
573 + "Epoch 29/200 Step 540... Discriminator Loss: 1.2600... Generator Loss: 1.5470\n",
574 + "(?, 4, 4, 1024)\n",
575 + "(?, 6, 6, 512)\n",
576 + "(?, 12, 12, 256)\n",
577 + "(?, 25, 25, 3)\n",
578 + "Epoch 29/200 Step 550... Discriminator Loss: 1.1592... Generator Loss: 0.9399\n",
579 + "(?, 4, 4, 1024)\n",
580 + "(?, 6, 6, 512)\n",
581 + "(?, 12, 12, 256)\n",
582 + "(?, 25, 25, 3)\n",
583 + "Epoch 30/200 Step 560... Discriminator Loss: 1.1941... Generator Loss: 1.0776\n",
584 + "(?, 4, 4, 1024)\n",
585 + "(?, 6, 6, 512)\n",
586 + "(?, 12, 12, 256)\n",
587 + "(?, 25, 25, 3)\n",
588 + "Epoch 30/200 Step 570... Discriminator Loss: 1.5479... Generator Loss: 2.1296\n",
589 + "(?, 4, 4, 1024)\n",
590 + "(?, 6, 6, 512)\n",
591 + "(?, 12, 12, 256)\n",
592 + "(?, 25, 25, 3)\n",
593 + "Epoch 31/200 Step 580... Discriminator Loss: 1.3233... Generator Loss: 0.8222\n",
594 + "(?, 4, 4, 1024)\n",
595 + "(?, 6, 6, 512)\n",
596 + "(?, 12, 12, 256)\n",
597 + "(?, 25, 25, 3)\n"
598 + ]
599 + },
600 + {
601 + "name": "stdout",
602 + "output_type": "stream",
603 + "text": [
604 + "Epoch 32/200 Step 590... Discriminator Loss: 1.1821... Generator Loss: 0.9809\n",
284 "(?, 4, 4, 1024)\n", 605 "(?, 4, 4, 1024)\n",
285 "(?, 6, 6, 512)\n", 606 "(?, 6, 6, 512)\n",
286 "(?, 12, 12, 256)\n", 607 "(?, 12, 12, 256)\n",
287 "(?, 25, 25, 3)\n", 608 "(?, 25, 25, 3)\n",
288 - "INFO:tensorflow:Restoring parameters from /tmp/model.ckpt\n" 609 + "Epoch 32/200 Step 600... Discriminator Loss: 1.1763... Generator Loss: 0.7344\n",
610 + "(?, 4, 4, 1024)\n",
611 + "(?, 6, 6, 512)\n",
612 + "(?, 12, 12, 256)\n",
613 + "(?, 25, 25, 3)\n",
614 + "Epoch 33/200 Step 610... Discriminator Loss: 1.1730... Generator Loss: 1.3747\n",
615 + "(?, 4, 4, 1024)\n",
616 + "(?, 6, 6, 512)\n",
617 + "(?, 12, 12, 256)\n",
618 + "(?, 25, 25, 3)\n",
619 + "Epoch 33/200 Step 620... Discriminator Loss: 1.5791... Generator Loss: 0.3566\n",
620 + "(?, 4, 4, 1024)\n",
621 + "(?, 6, 6, 512)\n",
622 + "(?, 12, 12, 256)\n",
623 + "(?, 25, 25, 3)\n",
624 + "Epoch 34/200 Step 630... Discriminator Loss: 1.4445... Generator Loss: 0.4481\n",
625 + "(?, 4, 4, 1024)\n",
626 + "(?, 6, 6, 512)\n",
627 + "(?, 12, 12, 256)\n",
628 + "(?, 25, 25, 3)\n",
629 + "Epoch 34/200 Step 640... Discriminator Loss: 1.1244... Generator Loss: 1.1338\n",
630 + "(?, 4, 4, 1024)\n",
631 + "(?, 6, 6, 512)\n",
632 + "(?, 12, 12, 256)\n",
633 + "(?, 25, 25, 3)\n",
634 + "Epoch 35/200 Step 650... Discriminator Loss: 1.1750... Generator Loss: 0.9281\n",
635 + "(?, 4, 4, 1024)\n",
636 + "(?, 6, 6, 512)\n",
637 + "(?, 12, 12, 256)\n",
638 + "(?, 25, 25, 3)\n",
639 + "Epoch 35/200 Step 660... Discriminator Loss: 1.2072... Generator Loss: 1.1870\n",
640 + "(?, 4, 4, 1024)\n",
641 + "(?, 6, 6, 512)\n",
642 + "(?, 12, 12, 256)\n",
643 + "(?, 25, 25, 3)\n",
644 + "Epoch 36/200 Step 670... Discriminator Loss: 1.2960... Generator Loss: 0.5793\n",
645 + "(?, 4, 4, 1024)\n",
646 + "(?, 6, 6, 512)\n",
647 + "(?, 12, 12, 256)\n",
648 + "(?, 25, 25, 3)\n",
649 + "Epoch 36/200 Step 680... Discriminator Loss: 1.1635... Generator Loss: 1.0436\n",
650 + "(?, 4, 4, 1024)\n",
651 + "(?, 6, 6, 512)\n",
652 + "(?, 12, 12, 256)\n",
653 + "(?, 25, 25, 3)\n"
289 ] 654 ]
290 }, 655 },
291 { 656 {
292 - "ename": "FileExistsError", 657 + "ename": "KeyboardInterrupt",
293 - "evalue": "[Errno 17] File exists: 'output'", 658 + "evalue": "",
294 "output_type": "error", 659 "output_type": "error",
295 "traceback": [ 660 "traceback": [
296 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 661 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
297 - "\u001b[0;31mFileExistsError\u001b[0m Traceback (most recent call last)", 662 + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
298 - "\u001b[0;32m<ipython-input-10-3cf64f8b526a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mceleba_dataset\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'./motionpatch/*.png'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGraph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mz_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlearning_rate\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbeta1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_batches\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimage_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 663 + "\u001b[0;32m<ipython-input-10-bbe3447e21dd>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mceleba_dataset\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'./smallone/*.png'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGraph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mz_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlearning_rate\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbeta1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_batches\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimage_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
299 - "\u001b[0;32m<ipython-input-8-4eafe8fdaf6d>\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode, print_every, show_every)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0mthreads\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart_queue_runners\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msess\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msess\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcoord\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcoord\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;31m#sess.run(tf.global_variables_initializer())\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmkdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'output'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mepoch_i\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepoch_count\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mbatch_images\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mget_batches\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 664 + "\u001b[0;32m<ipython-input-8-2e8656e87584>\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode, print_every, show_every)\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;31m# Run optimizers\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0md_train_opt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0minput_real\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_images\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_z\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_z\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 43\u001b[0;31m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg_train_opt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0minput_z\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_z\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 44\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msteps\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mprint_every\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
300 - "\u001b[0;31mFileExistsError\u001b[0m: [Errno 17] File exists: 'output'" 665 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 875\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 876\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[0;32m--> 877\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
666 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1098\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mhandle\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mfeed_dict_tensor\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1099\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[0;32m-> 1100\u001b[0;31m feed_dict_tensor, options, run_metadata)\n\u001b[0m\u001b[1;32m 1101\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1102\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
667 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_run\u001b[0;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1270\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1271\u001b[0m return self._do_call(_run_fn, feeds, fetches, targets, options,\n\u001b[0;32m-> 1272\u001b[0;31m run_metadata)\n\u001b[0m\u001b[1;32m 1273\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1274\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_do_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_prun_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeeds\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetches\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
668 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_call\u001b[0;34m(self, fn, *args)\u001b[0m\n\u001b[1;32m 1276\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_do_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1277\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1278\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1279\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1280\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcompat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_text\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
669 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[0;34m(feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[1;32m 1261\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_extend_graph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1262\u001b[0m return self._call_tf_sessionrun(\n\u001b[0;32m-> 1263\u001b[0;31m options, feed_dict, fetch_list, target_list, run_metadata)\n\u001b[0m\u001b[1;32m 1264\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1265\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_prun_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
670 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_call_tf_sessionrun\u001b[0;34m(self, options, feed_dict, fetch_list, target_list, run_metadata)\u001b[0m\n\u001b[1;32m 1348\u001b[0m return tf_session.TF_SessionRun_wrapper(\n\u001b[1;32m 1349\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1350\u001b[0;31m run_metadata)\n\u001b[0m\u001b[1;32m 1351\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1352\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_call_tf_sessionprun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
671 + "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
301 ] 672 ]
302 } 673 }
303 ], 674 ],
304 "source": [ 675 "source": [
305 - "batch_size = 50\n", 676 + "batch_size = 256\n",
306 "z_dim = 100\n", 677 "z_dim = 100\n",
307 "learning_rate = 0.00025\n", 678 "learning_rate = 0.00025\n",
308 "beta1 = 0.45\n", 679 "beta1 = 0.45\n",
309 "\n", 680 "\n",
310 - "epochs = 500\n", 681 + "epochs = 200\n",
311 - "print(len(glob('./motionpatch/*.png')))\n", 682 + "print(len(glob('./smallone/*.png')))\n",
312 - "celeba_dataset = Dataset( glob('./motionpatch/*.png'))\n", 683 + "celeba_dataset = Dataset( glob('./smallone/*.png'))\n",
313 "with tf.Graph().as_default():\n", 684 "with tf.Graph().as_default():\n",
314 " train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches, celeba_dataset.shape, celeba_dataset.image_mode)" 685 " train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches, celeba_dataset.shape, celeba_dataset.image_mode)"
315 ] 686 ]
......
1 +{
2 + "cells": [
3 + {
4 + "cell_type": "code",
5 + "execution_count": 2,
6 + "metadata": {},
7 + "outputs": [],
8 + "source": [
9 + "import cv2\n",
10 + "from glob import glob\n",
11 + "import os \n",
12 + "\n",
13 + "motionpatch_location = './motionpatch/*.png'\n",
14 + "output_location = './smallone/'\n",
15 + "count = 0\n",
16 + "for f in glob(motionpatch_location):\n",
17 + " count += 1\n",
18 + " image = cv2.imread(f)\n",
19 + " small = cv2.resize(image,dsize=(25,25))\n",
20 + " dst = os.path.join(output_location +str(count)+\".png\")\n",
21 + " cv2.imwrite(dst,small)"
22 + ]
23 + },
24 + {
25 + "cell_type": "code",
26 + "execution_count": null,
27 + "metadata": {},
28 + "outputs": [],
29 + "source": []
30 + }
31 + ],
32 + "metadata": {
33 + "kernelspec": {
34 + "display_name": "Python 3",
35 + "language": "python",
36 + "name": "python3"
37 + },
38 + "language_info": {
39 + "codemirror_mode": {
40 + "name": "ipython",
41 + "version": 3
42 + },
43 + "file_extension": ".py",
44 + "mimetype": "text/x-python",
45 + "name": "python",
46 + "nbconvert_exporter": "python",
47 + "pygments_lexer": "ipython3",
48 + "version": "3.5.0"
49 + }
50 + },
51 + "nbformat": 4,
52 + "nbformat_minor": 2
53 +}
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
34 " self.data_files = data_files\n", 34 " self.data_files = data_files\n",
35 " self.shape = len(data_files), IMAGE_WIDTH, IMAGE_HEIGHT, image_channels\n", 35 " self.shape = len(data_files), IMAGE_WIDTH, IMAGE_HEIGHT, image_channels\n",
36 " \n", 36 " \n",
37 - " def get_image(iself,mage_path, width, height, mode):\n", 37 + " def get_image(iself,image_path, width, height, mode):\n",
38 " image = Image.open(image_path)\n", 38 " image = Image.open(image_path)\n",
39 " image = image.resize((width,height))\n", 39 " image = image.resize((width,height))\n",
40 " return np.array(image)\n", 40 " return np.array(image)\n",
...@@ -234,10 +234,14 @@ ...@@ -234,10 +234,14 @@
234 " saver = tf.train.Saver()\n", 234 " saver = tf.train.Saver()\n",
235 " sess.run(tf.global_variables_initializer())\n", 235 " sess.run(tf.global_variables_initializer())\n",
236 " \n", 236 " \n",
237 - " # continue training\n", 237 + " # continue training\n",
238 " save_path = saver.save(sess, \"/tmp/model.ckpt\")\n", 238 " save_path = saver.save(sess, \"/tmp/model.ckpt\")\n",
239 " ckpt = tf.train.latest_checkpoint('./model/')\n", 239 " ckpt = tf.train.latest_checkpoint('./model/')\n",
240 " saver.restore(sess, save_path)\n", 240 " saver.restore(sess, save_path)\n",
241 + " \n",
242 + " #newsaver = tf.train.import_meta_graph('./model/70.meta')\n",
243 + " #newsaver.restore(sess, tf.train.latest_checkpoint('./model/'))\n",
244 + " \n",
241 " coord = tf.train.Coordinator()\n", 245 " coord = tf.train.Coordinator()\n",
242 " threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n", 246 " threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n",
243 "\n", 247 "\n",
...@@ -286,7 +290,7 @@ ...@@ -286,7 +290,7 @@
286 }, 290 },
287 { 291 {
288 "cell_type": "code", 292 "cell_type": "code",
289 - "execution_count": 9, 293 + "execution_count": 10,
290 "metadata": { 294 "metadata": {
291 "scrolled": true 295 "scrolled": true
292 }, 296 },
...@@ -295,40 +299,388 @@ ...@@ -295,40 +299,388 @@
295 "name": "stdout", 299 "name": "stdout",
296 "output_type": "stream", 300 "output_type": "stream",
297 "text": [ 301 "text": [
298 - "140\n", 302 + "5004\n",
303 + "(?, 4, 4, 1024)\n",
304 + "(?, 6, 6, 512)\n",
305 + "(?, 12, 12, 256)\n",
306 + "(?, 25, 25, 3)\n",
307 + "INFO:tensorflow:Restoring parameters from /tmp/model.ckpt\n",
308 + "Epoch 1/200 Step 10... Discriminator Loss: 0.7986... Generator Loss: 2.7782\n",
309 + "(?, 4, 4, 1024)\n",
310 + "(?, 6, 6, 512)\n",
311 + "(?, 12, 12, 256)\n",
312 + "(?, 25, 25, 3)\n",
313 + "Epoch 2/200 Step 20... Discriminator Loss: 0.7019... Generator Loss: 1.2096\n",
314 + "(?, 4, 4, 1024)\n",
315 + "(?, 6, 6, 512)\n",
316 + "(?, 12, 12, 256)\n",
317 + "(?, 25, 25, 3)\n",
318 + "Epoch 2/200 Step 30... Discriminator Loss: 0.6407... Generator Loss: 1.7675\n",
319 + "(?, 4, 4, 1024)\n",
320 + "(?, 6, 6, 512)\n",
321 + "(?, 12, 12, 256)\n",
322 + "(?, 25, 25, 3)\n",
323 + "Epoch 3/200 Step 40... Discriminator Loss: 0.9732... Generator Loss: 0.9018\n",
324 + "(?, 4, 4, 1024)\n",
325 + "(?, 6, 6, 512)\n",
326 + "(?, 12, 12, 256)\n",
327 + "(?, 25, 25, 3)\n",
328 + "Epoch 3/200 Step 50... Discriminator Loss: 1.2455... Generator Loss: 2.2003\n",
329 + "(?, 4, 4, 1024)\n",
330 + "(?, 6, 6, 512)\n",
331 + "(?, 12, 12, 256)\n",
332 + "(?, 25, 25, 3)\n",
333 + "Epoch 4/200 Step 60... Discriminator Loss: 0.9650... Generator Loss: 1.1981\n",
334 + "(?, 4, 4, 1024)\n",
335 + "(?, 6, 6, 512)\n",
336 + "(?, 12, 12, 256)\n",
337 + "(?, 25, 25, 3)\n",
338 + "Epoch 4/200 Step 70... Discriminator Loss: 0.9376... Generator Loss: 1.6022\n",
339 + "(?, 4, 4, 1024)\n",
340 + "(?, 6, 6, 512)\n",
341 + "(?, 12, 12, 256)\n",
342 + "(?, 25, 25, 3)\n",
343 + "Epoch 5/200 Step 80... Discriminator Loss: 0.9873... Generator Loss: 0.9408\n",
344 + "(?, 4, 4, 1024)\n",
345 + "(?, 6, 6, 512)\n",
346 + "(?, 12, 12, 256)\n",
347 + "(?, 25, 25, 3)\n",
348 + "Epoch 5/200 Step 90... Discriminator Loss: 1.1370... Generator Loss: 2.2449\n",
349 + "(?, 4, 4, 1024)\n",
350 + "(?, 6, 6, 512)\n",
351 + "(?, 12, 12, 256)\n",
352 + "(?, 25, 25, 3)\n",
353 + "Epoch 6/200 Step 100... Discriminator Loss: 0.9307... Generator Loss: 1.1019\n",
354 + "(?, 4, 4, 1024)\n",
355 + "(?, 6, 6, 512)\n",
356 + "(?, 12, 12, 256)\n",
357 + "(?, 25, 25, 3)\n",
358 + "Epoch 6/200 Step 110... Discriminator Loss: 0.9045... Generator Loss: 1.3023\n",
359 + "(?, 4, 4, 1024)\n",
360 + "(?, 6, 6, 512)\n",
361 + "(?, 12, 12, 256)\n",
362 + "(?, 25, 25, 3)\n",
363 + "Epoch 7/200 Step 120... Discriminator Loss: 1.4306... Generator Loss: 3.0811\n",
364 + "(?, 4, 4, 1024)\n",
365 + "(?, 6, 6, 512)\n",
366 + "(?, 12, 12, 256)\n",
367 + "(?, 25, 25, 3)\n",
368 + "Epoch 7/200 Step 130... Discriminator Loss: 0.8306... Generator Loss: 1.4418\n",
369 + "(?, 4, 4, 1024)\n",
370 + "(?, 6, 6, 512)\n",
371 + "(?, 12, 12, 256)\n",
372 + "(?, 25, 25, 3)\n",
373 + "Epoch 8/200 Step 140... Discriminator Loss: 1.0130... Generator Loss: 0.9772\n",
374 + "(?, 4, 4, 1024)\n",
375 + "(?, 6, 6, 512)\n",
376 + "(?, 12, 12, 256)\n",
377 + "(?, 25, 25, 3)\n",
378 + "Epoch 8/200 Step 150... Discriminator Loss: 1.1253... Generator Loss: 2.7651\n",
379 + "(?, 4, 4, 1024)\n",
380 + "(?, 6, 6, 512)\n",
381 + "(?, 12, 12, 256)\n",
382 + "(?, 25, 25, 3)\n",
383 + "Epoch 9/200 Step 160... Discriminator Loss: 1.2028... Generator Loss: 0.5614\n",
384 + "(?, 4, 4, 1024)\n",
385 + "(?, 6, 6, 512)\n",
386 + "(?, 12, 12, 256)\n",
387 + "(?, 25, 25, 3)\n",
388 + "Epoch 9/200 Step 170... Discriminator Loss: 1.1864... Generator Loss: 0.6131\n",
389 + "(?, 4, 4, 1024)\n",
390 + "(?, 6, 6, 512)\n",
391 + "(?, 12, 12, 256)\n",
392 + "(?, 25, 25, 3)\n",
393 + "Epoch 10/200 Step 180... Discriminator Loss: 0.8613... Generator Loss: 1.1399\n",
394 + "(?, 4, 4, 1024)\n",
395 + "(?, 6, 6, 512)\n",
396 + "(?, 12, 12, 256)\n",
397 + "(?, 25, 25, 3)\n",
398 + "Epoch 10/200 Step 190... Discriminator Loss: 0.7570... Generator Loss: 1.9568\n",
399 + "(?, 4, 4, 1024)\n",
400 + "(?, 6, 6, 512)\n",
401 + "(?, 12, 12, 256)\n",
402 + "(?, 25, 25, 3)\n",
403 + "Epoch 11/200 Step 200... Discriminator Loss: 0.8872... Generator Loss: 1.3420\n",
404 + "(?, 4, 4, 1024)\n",
405 + "(?, 6, 6, 512)\n",
406 + "(?, 12, 12, 256)\n",
407 + "(?, 25, 25, 3)\n",
408 + "Epoch 12/200 Step 210... Discriminator Loss: 0.7758... Generator Loss: 1.3705\n",
409 + "(?, 4, 4, 1024)\n",
410 + "(?, 6, 6, 512)\n",
411 + "(?, 12, 12, 256)\n",
412 + "(?, 25, 25, 3)\n",
413 + "Epoch 12/200 Step 220... Discriminator Loss: 0.9375... Generator Loss: 2.3697\n",
414 + "(?, 4, 4, 1024)\n",
415 + "(?, 6, 6, 512)\n",
416 + "(?, 12, 12, 256)\n",
417 + "(?, 25, 25, 3)\n",
418 + "Epoch 13/200 Step 230... Discriminator Loss: 1.0274... Generator Loss: 2.6057\n",
419 + "(?, 4, 4, 1024)\n",
420 + "(?, 6, 6, 512)\n",
421 + "(?, 12, 12, 256)\n",
422 + "(?, 25, 25, 3)\n",
423 + "Epoch 13/200 Step 240... Discriminator Loss: 0.8219... Generator Loss: 1.2095\n",
424 + "(?, 4, 4, 1024)\n",
425 + "(?, 6, 6, 512)\n",
426 + "(?, 12, 12, 256)\n",
427 + "(?, 25, 25, 3)\n",
428 + "Epoch 14/200 Step 250... Discriminator Loss: 0.8607... Generator Loss: 1.8890\n",
429 + "(?, 4, 4, 1024)\n",
430 + "(?, 6, 6, 512)\n",
431 + "(?, 12, 12, 256)\n",
432 + "(?, 25, 25, 3)\n",
433 + "Epoch 14/200 Step 260... Discriminator Loss: 0.8661... Generator Loss: 1.4806\n",
434 + "(?, 4, 4, 1024)\n",
435 + "(?, 6, 6, 512)\n",
436 + "(?, 12, 12, 256)\n",
437 + "(?, 25, 25, 3)\n",
438 + "Epoch 15/200 Step 270... Discriminator Loss: 0.8005... Generator Loss: 1.6766\n",
439 + "(?, 4, 4, 1024)\n",
440 + "(?, 6, 6, 512)\n",
441 + "(?, 12, 12, 256)\n",
442 + "(?, 25, 25, 3)\n",
443 + "Epoch 15/200 Step 280... Discriminator Loss: 0.8658... Generator Loss: 1.6609\n",
444 + "(?, 4, 4, 1024)\n",
445 + "(?, 6, 6, 512)\n",
446 + "(?, 12, 12, 256)\n",
447 + "(?, 25, 25, 3)\n",
448 + "Epoch 16/200 Step 290... Discriminator Loss: 1.3357... Generator Loss: 0.5010\n",
449 + "(?, 4, 4, 1024)\n",
450 + "(?, 6, 6, 512)\n",
451 + "(?, 12, 12, 256)\n",
452 + "(?, 25, 25, 3)\n",
453 + "Epoch 16/200 Step 300... Discriminator Loss: 0.8518... Generator Loss: 1.4408\n",
454 + "(?, 4, 4, 1024)\n",
455 + "(?, 6, 6, 512)\n",
456 + "(?, 12, 12, 256)\n",
457 + "(?, 25, 25, 3)\n",
458 + "Epoch 17/200 Step 310... Discriminator Loss: 0.9052... Generator Loss: 1.2558\n",
459 + "(?, 4, 4, 1024)\n",
460 + "(?, 6, 6, 512)\n",
461 + "(?, 12, 12, 256)\n",
462 + "(?, 25, 25, 3)\n",
463 + "Epoch 17/200 Step 320... Discriminator Loss: 0.9011... Generator Loss: 1.2468\n",
464 + "(?, 4, 4, 1024)\n",
465 + "(?, 6, 6, 512)\n",
466 + "(?, 12, 12, 256)\n",
467 + "(?, 25, 25, 3)\n",
468 + "Epoch 18/200 Step 330... Discriminator Loss: 0.9880... Generator Loss: 0.8800\n",
469 + "(?, 4, 4, 1024)\n",
470 + "(?, 6, 6, 512)\n",
471 + "(?, 12, 12, 256)\n",
472 + "(?, 25, 25, 3)\n",
473 + "Epoch 18/200 Step 340... Discriminator Loss: 0.9066... Generator Loss: 2.0460\n",
474 + "(?, 4, 4, 1024)\n",
475 + "(?, 6, 6, 512)\n",
476 + "(?, 12, 12, 256)\n",
477 + "(?, 25, 25, 3)\n",
478 + "Epoch 19/200 Step 350... Discriminator Loss: 0.9169... Generator Loss: 1.7369\n",
479 + "(?, 4, 4, 1024)\n",
480 + "(?, 6, 6, 512)\n",
481 + "(?, 12, 12, 256)\n",
482 + "(?, 25, 25, 3)\n",
483 + "Epoch 19/200 Step 360... Discriminator Loss: 0.9111... Generator Loss: 1.5251\n",
484 + "(?, 4, 4, 1024)\n",
485 + "(?, 6, 6, 512)\n",
486 + "(?, 12, 12, 256)\n",
487 + "(?, 25, 25, 3)\n",
488 + "Epoch 20/200 Step 370... Discriminator Loss: 0.9466... Generator Loss: 1.0476\n",
489 + "(?, 4, 4, 1024)\n",
490 + "(?, 6, 6, 512)\n",
491 + "(?, 12, 12, 256)\n",
492 + "(?, 25, 25, 3)\n",
493 + "Epoch 20/200 Step 380... Discriminator Loss: 1.0600... Generator Loss: 1.6264\n",
494 + "(?, 4, 4, 1024)\n",
495 + "(?, 6, 6, 512)\n",
496 + "(?, 12, 12, 256)\n",
497 + "(?, 25, 25, 3)\n",
498 + "Epoch 21/200 Step 390... Discriminator Loss: 1.1503... Generator Loss: 0.9095\n",
499 + "(?, 4, 4, 1024)\n",
500 + "(?, 6, 6, 512)\n",
501 + "(?, 12, 12, 256)\n",
502 + "(?, 25, 25, 3)\n",
503 + "Epoch 22/200 Step 400... Discriminator Loss: 1.1989... Generator Loss: 1.2204\n",
504 + "(?, 4, 4, 1024)\n",
505 + "(?, 6, 6, 512)\n",
506 + "(?, 12, 12, 256)\n",
507 + "(?, 25, 25, 3)\n",
508 + "Epoch 22/200 Step 410... Discriminator Loss: 1.1530... Generator Loss: 0.8920\n",
509 + "(?, 4, 4, 1024)\n",
510 + "(?, 6, 6, 512)\n",
511 + "(?, 12, 12, 256)\n",
512 + "(?, 25, 25, 3)\n",
513 + "Epoch 23/200 Step 420... Discriminator Loss: 1.2206... Generator Loss: 0.8665\n",
514 + "(?, 4, 4, 1024)\n",
515 + "(?, 6, 6, 512)\n",
516 + "(?, 12, 12, 256)\n",
517 + "(?, 25, 25, 3)\n",
518 + "Epoch 23/200 Step 430... Discriminator Loss: 1.1357... Generator Loss: 1.0771\n",
519 + "(?, 4, 4, 1024)\n",
520 + "(?, 6, 6, 512)\n",
521 + "(?, 12, 12, 256)\n",
522 + "(?, 25, 25, 3)\n",
523 + "Epoch 24/200 Step 440... Discriminator Loss: 1.5018... Generator Loss: 0.4140\n",
524 + "(?, 4, 4, 1024)\n",
525 + "(?, 6, 6, 512)\n",
526 + "(?, 12, 12, 256)\n",
527 + "(?, 25, 25, 3)\n",
528 + "Epoch 24/200 Step 450... Discriminator Loss: 1.1407... Generator Loss: 0.9182\n",
529 + "(?, 4, 4, 1024)\n",
530 + "(?, 6, 6, 512)\n",
531 + "(?, 12, 12, 256)\n",
532 + "(?, 25, 25, 3)\n",
533 + "Epoch 25/200 Step 460... Discriminator Loss: 1.1208... Generator Loss: 1.0497\n",
534 + "(?, 4, 4, 1024)\n",
535 + "(?, 6, 6, 512)\n",
536 + "(?, 12, 12, 256)\n",
537 + "(?, 25, 25, 3)\n",
538 + "Epoch 25/200 Step 470... Discriminator Loss: 1.2283... Generator Loss: 1.3409\n",
539 + "(?, 4, 4, 1024)\n",
540 + "(?, 6, 6, 512)\n",
541 + "(?, 12, 12, 256)\n",
542 + "(?, 25, 25, 3)\n",
543 + "Epoch 26/200 Step 480... Discriminator Loss: 1.1401... Generator Loss: 0.8807\n",
544 + "(?, 4, 4, 1024)\n",
545 + "(?, 6, 6, 512)\n",
546 + "(?, 12, 12, 256)\n",
547 + "(?, 25, 25, 3)\n",
548 + "Epoch 26/200 Step 490... Discriminator Loss: 1.1839... Generator Loss: 0.7198\n",
549 + "(?, 4, 4, 1024)\n",
550 + "(?, 6, 6, 512)\n",
551 + "(?, 12, 12, 256)\n",
552 + "(?, 25, 25, 3)\n",
553 + "Epoch 27/200 Step 500... Discriminator Loss: 1.5919... Generator Loss: 0.3560\n",
554 + "(?, 4, 4, 1024)\n",
555 + "(?, 6, 6, 512)\n",
556 + "(?, 12, 12, 256)\n",
557 + "(?, 25, 25, 3)\n",
558 + "Epoch 27/200 Step 510... Discriminator Loss: 1.2166... Generator Loss: 1.4234\n",
559 + "(?, 4, 4, 1024)\n",
560 + "(?, 6, 6, 512)\n",
561 + "(?, 12, 12, 256)\n",
562 + "(?, 25, 25, 3)\n",
563 + "Epoch 28/200 Step 520... Discriminator Loss: 1.1838... Generator Loss: 1.2357\n",
564 + "(?, 4, 4, 1024)\n",
565 + "(?, 6, 6, 512)\n",
566 + "(?, 12, 12, 256)\n",
567 + "(?, 25, 25, 3)\n",
568 + "Epoch 28/200 Step 530... Discriminator Loss: 1.2062... Generator Loss: 1.4508\n",
569 + "(?, 4, 4, 1024)\n",
570 + "(?, 6, 6, 512)\n",
571 + "(?, 12, 12, 256)\n",
572 + "(?, 25, 25, 3)\n",
573 + "Epoch 29/200 Step 540... Discriminator Loss: 1.2600... Generator Loss: 1.5470\n",
574 + "(?, 4, 4, 1024)\n",
575 + "(?, 6, 6, 512)\n",
576 + "(?, 12, 12, 256)\n",
577 + "(?, 25, 25, 3)\n",
578 + "Epoch 29/200 Step 550... Discriminator Loss: 1.1592... Generator Loss: 0.9399\n",
579 + "(?, 4, 4, 1024)\n",
580 + "(?, 6, 6, 512)\n",
581 + "(?, 12, 12, 256)\n",
582 + "(?, 25, 25, 3)\n",
583 + "Epoch 30/200 Step 560... Discriminator Loss: 1.1941... Generator Loss: 1.0776\n",
584 + "(?, 4, 4, 1024)\n",
585 + "(?, 6, 6, 512)\n",
586 + "(?, 12, 12, 256)\n",
587 + "(?, 25, 25, 3)\n",
588 + "Epoch 30/200 Step 570... Discriminator Loss: 1.5479... Generator Loss: 2.1296\n",
589 + "(?, 4, 4, 1024)\n",
590 + "(?, 6, 6, 512)\n",
591 + "(?, 12, 12, 256)\n",
592 + "(?, 25, 25, 3)\n",
593 + "Epoch 31/200 Step 580... Discriminator Loss: 1.3233... Generator Loss: 0.8222\n",
594 + "(?, 4, 4, 1024)\n",
595 + "(?, 6, 6, 512)\n",
596 + "(?, 12, 12, 256)\n",
597 + "(?, 25, 25, 3)\n"
598 + ]
599 + },
600 + {
601 + "name": "stdout",
602 + "output_type": "stream",
603 + "text": [
604 + "Epoch 32/200 Step 590... Discriminator Loss: 1.1821... Generator Loss: 0.9809\n",
299 "(?, 4, 4, 1024)\n", 605 "(?, 4, 4, 1024)\n",
300 "(?, 6, 6, 512)\n", 606 "(?, 6, 6, 512)\n",
301 "(?, 12, 12, 256)\n", 607 "(?, 12, 12, 256)\n",
302 "(?, 25, 25, 3)\n", 608 "(?, 25, 25, 3)\n",
303 - "INFO:tensorflow:Restoring parameters from /tmp/model.ckpt\n" 609 + "Epoch 32/200 Step 600... Discriminator Loss: 1.1763... Generator Loss: 0.7344\n",
610 + "(?, 4, 4, 1024)\n",
611 + "(?, 6, 6, 512)\n",
612 + "(?, 12, 12, 256)\n",
613 + "(?, 25, 25, 3)\n",
614 + "Epoch 33/200 Step 610... Discriminator Loss: 1.1730... Generator Loss: 1.3747\n",
615 + "(?, 4, 4, 1024)\n",
616 + "(?, 6, 6, 512)\n",
617 + "(?, 12, 12, 256)\n",
618 + "(?, 25, 25, 3)\n",
619 + "Epoch 33/200 Step 620... Discriminator Loss: 1.5791... Generator Loss: 0.3566\n",
620 + "(?, 4, 4, 1024)\n",
621 + "(?, 6, 6, 512)\n",
622 + "(?, 12, 12, 256)\n",
623 + "(?, 25, 25, 3)\n",
624 + "Epoch 34/200 Step 630... Discriminator Loss: 1.4445... Generator Loss: 0.4481\n",
625 + "(?, 4, 4, 1024)\n",
626 + "(?, 6, 6, 512)\n",
627 + "(?, 12, 12, 256)\n",
628 + "(?, 25, 25, 3)\n",
629 + "Epoch 34/200 Step 640... Discriminator Loss: 1.1244... Generator Loss: 1.1338\n",
630 + "(?, 4, 4, 1024)\n",
631 + "(?, 6, 6, 512)\n",
632 + "(?, 12, 12, 256)\n",
633 + "(?, 25, 25, 3)\n",
634 + "Epoch 35/200 Step 650... Discriminator Loss: 1.1750... Generator Loss: 0.9281\n",
635 + "(?, 4, 4, 1024)\n",
636 + "(?, 6, 6, 512)\n",
637 + "(?, 12, 12, 256)\n",
638 + "(?, 25, 25, 3)\n",
639 + "Epoch 35/200 Step 660... Discriminator Loss: 1.2072... Generator Loss: 1.1870\n",
640 + "(?, 4, 4, 1024)\n",
641 + "(?, 6, 6, 512)\n",
642 + "(?, 12, 12, 256)\n",
643 + "(?, 25, 25, 3)\n",
644 + "Epoch 36/200 Step 670... Discriminator Loss: 1.2960... Generator Loss: 0.5793\n",
645 + "(?, 4, 4, 1024)\n",
646 + "(?, 6, 6, 512)\n",
647 + "(?, 12, 12, 256)\n",
648 + "(?, 25, 25, 3)\n",
649 + "Epoch 36/200 Step 680... Discriminator Loss: 1.1635... Generator Loss: 1.0436\n",
650 + "(?, 4, 4, 1024)\n",
651 + "(?, 6, 6, 512)\n",
652 + "(?, 12, 12, 256)\n",
653 + "(?, 25, 25, 3)\n"
304 ] 654 ]
305 }, 655 },
306 { 656 {
307 - "ename": "NameError", 657 + "ename": "KeyboardInterrupt",
308 - "evalue": "name 'image_path' is not defined", 658 + "evalue": "",
309 "output_type": "error", 659 "output_type": "error",
310 "traceback": [ 660 "traceback": [
311 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 661 "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
312 - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", 662 + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
313 - "\u001b[0;32m<ipython-input-9-3cf64f8b526a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mceleba_dataset\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'./motionpatch/*.png'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGraph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mz_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlearning_rate\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbeta1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_batches\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimage_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 663 + "\u001b[0;32m<ipython-input-10-bbe3447e21dd>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mceleba_dataset\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'./smallone/*.png'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGraph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mz_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlearning_rate\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbeta1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_batches\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mceleba_dataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimage_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
314 - "\u001b[0;32m<ipython-input-8-14a3faf19639>\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode, print_every, show_every)\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmkdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'output'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mepoch_i\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mepoch_count\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mbatch_images\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mget_batches\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch_size\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;31m# Train Model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0msteps\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 664 + "\u001b[0;32m<ipython-input-8-2e8656e87584>\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode, print_every, show_every)\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;31m# Run optimizers\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0md_train_opt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0minput_real\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_images\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_z\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_z\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 43\u001b[0;31m \u001b[0msess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg_train_opt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0minput_z\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbatch_z\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 44\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msteps\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mprint_every\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
315 - "\u001b[0;32m<ipython-input-2-77ee1ea74a0f>\u001b[0m in \u001b[0;36mget_batches\u001b[0;34m(self, batch_size)\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata_files\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcurrent_index\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mcurrent_index\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 32\u001b[0;31m self.image_mode)\n\u001b[0m\u001b[1;32m 33\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[0mcurrent_index\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 665 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 875\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 876\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[0;32m--> 877\u001b[0;31m run_metadata_ptr)\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
316 - "\u001b[0;32m<ipython-input-2-77ee1ea74a0f>\u001b[0m in \u001b[0;36mget_batch\u001b[0;34m(self, image_files, width, height, mode)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mget_batch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mimage_files\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mwidth\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheight\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m data_batch = np.array(\n\u001b[0;32m---> 18\u001b[0;31m [self.get_image(sample_file, width, height, mode) for sample_file in image_files]).astype(np.float32)\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;31m# Make sure the images are in 4 dimensions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 666 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1098\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mhandle\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mfeed_dict_tensor\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1099\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[0;32m-> 1100\u001b[0;31m feed_dict_tensor, options, run_metadata)\n\u001b[0m\u001b[1;32m 1101\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1102\u001b[0m \u001b[0mresults\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
317 - "\u001b[0;32m<ipython-input-2-77ee1ea74a0f>\u001b[0m in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mget_batch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mimage_files\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mwidth\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheight\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m data_batch = np.array(\n\u001b[0;32m---> 18\u001b[0;31m [self.get_image(sample_file, width, height, mode) for sample_file in image_files]).astype(np.float32)\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;31m# Make sure the images are in 4 dimensions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 667 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_run\u001b[0;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[1;32m 1270\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1271\u001b[0m return self._do_call(_run_fn, feeds, fetches, targets, options,\n\u001b[0;32m-> 1272\u001b[0;31m run_metadata)\n\u001b[0m\u001b[1;32m 1273\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1274\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_do_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_prun_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeeds\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetches\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
318 - "\u001b[0;32m<ipython-input-2-77ee1ea74a0f>\u001b[0m in \u001b[0;36mget_image\u001b[0;34m(iself, mage_path, width, height, mode)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mget_image\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0miself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmage_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mwidth\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheight\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mimage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimage_path\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 12\u001b[0m \u001b[0mimage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwidth\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mheight\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mimage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 668 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_do_call\u001b[0;34m(self, fn, *args)\u001b[0m\n\u001b[1;32m 1276\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_do_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1277\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1278\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1279\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1280\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcompat\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_text\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
319 - "\u001b[0;31mNameError\u001b[0m: name 'image_path' is not defined" 669 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[0;34m(feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[1;32m 1261\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_extend_graph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1262\u001b[0m return self._call_tf_sessionrun(\n\u001b[0;32m-> 1263\u001b[0;31m options, feed_dict, fetch_list, target_list, run_metadata)\n\u001b[0m\u001b[1;32m 1264\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1265\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_prun_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
670 + "\u001b[0;32m~/anaconda2/envs/actionGAN/lib/python3.5/site-packages/tensorflow/python/client/session.py\u001b[0m in \u001b[0;36m_call_tf_sessionrun\u001b[0;34m(self, options, feed_dict, fetch_list, target_list, run_metadata)\u001b[0m\n\u001b[1;32m 1348\u001b[0m return tf_session.TF_SessionRun_wrapper(\n\u001b[1;32m 1349\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1350\u001b[0;31m run_metadata)\n\u001b[0m\u001b[1;32m 1351\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1352\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_call_tf_sessionprun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
671 + "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
320 ] 672 ]
321 } 673 }
322 ], 674 ],
323 "source": [ 675 "source": [
324 - "batch_size = 50\n", 676 + "batch_size = 256\n",
325 "z_dim = 100\n", 677 "z_dim = 100\n",
326 "learning_rate = 0.00025\n", 678 "learning_rate = 0.00025\n",
327 "beta1 = 0.45\n", 679 "beta1 = 0.45\n",
328 "\n", 680 "\n",
329 - "epochs = 500\n", 681 + "epochs = 200\n",
330 - "print(len(glob('./motionpatch/*.png')))\n", 682 + "print(len(glob('./smallone/*.png')))\n",
331 - "celeba_dataset = Dataset( glob('./motionpatch/*.png'))\n", 683 + "celeba_dataset = Dataset( glob('./smallone/*.png'))\n",
332 "with tf.Graph().as_default():\n", 684 "with tf.Graph().as_default():\n",
333 " train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches, celeba_dataset.shape, celeba_dataset.image_mode)" 685 " train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches, celeba_dataset.shape, celeba_dataset.image_mode)"
334 ] 686 ]
......
This file is too large to display.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 "cells": [ 2 "cells": [
3 { 3 {
4 "cell_type": "code", 4 "cell_type": "code",
5 - "execution_count": 3, 5 + "execution_count": 2,
6 "metadata": {}, 6 "metadata": {},
7 "outputs": [], 7 "outputs": [],
8 "source": [ 8 "source": [
...@@ -20,6 +20,49 @@ ...@@ -20,6 +20,49 @@
20 " dst = os.path.join(output_location +str(count)+\".png\")\n", 20 " dst = os.path.join(output_location +str(count)+\".png\")\n",
21 " cv2.imwrite(dst,small)" 21 " cv2.imwrite(dst,small)"
22 ] 22 ]
23 + },
24 + {
25 + "cell_type": "code",
26 + "execution_count": null,
27 + "metadata": {},
28 + "outputs": [],
29 + "source": [
30 + " def __init__(self, data_files):\n",
31 + " IMAGE_WIDTH = 25\n",
32 + " IMAGE_HEIGHT = 25\n",
33 + " self.image_mode = 'RGB'\n",
34 + " image_channels = 3\n",
35 + " self.data_files = data_files\n",
36 + " self.shape = len(data_files), IMAGE_WIDTH, IMAGE_HEIGHT, image_channels\n",
37 + " \n",
38 + " def get_image(iself,image_path, width, height, mode):\n",
39 + " image = Image.open(image_path)\n",
40 + " image = Image.im2double(image)\n",
41 + " return np.array(image)"
42 + ]
43 + },
44 + {
45 + "cell_type": "code",
46 + "execution_count": 10,
47 + "metadata": {},
48 + "outputs": [],
49 + "source": [
50 + "from PIL import Image\n",
51 + "import numpy as np\n",
52 + "from matplotlib import pyplot\n",
53 + "\n",
54 + "imgloc = './smallone/5004.png'\n",
55 + "image = Image.open(imgloc)\n",
56 + "dst = os.path.join(\"./samples/5004.png\")\n",
57 + "pyplot.imsave(dst,image)\n"
58 + ]
59 + },
60 + {
61 + "cell_type": "code",
62 + "execution_count": null,
63 + "metadata": {},
64 + "outputs": [],
65 + "source": []
23 } 66 }
24 ], 67 ],
25 "metadata": { 68 "metadata": {
......
1 -S001C002P005R002A008
2 -S001C002P006R001A008
3 -S001C003P002R001A055
4 -S001C003P002R002A012
5 -S001C003P005R002A004
6 -S001C003P005R002A005
7 -S001C003P005R002A006
8 -S001C003P006R002A008
9 -S002C002P011R002A030
10 -S002C003P008R001A020
11 -S002C003P010R002A010
12 -S002C003P011R002A007
13 -S002C003P011R002A011
14 -S002C003P014R002A007
15 -S003C001P019R001A055
16 -S003C002P002R002A055
17 -S003C002P018R002A055
18 -S003C003P002R001A055
19 -S003C003P016R001A055
20 -S003C003P018R002A024
21 -S004C002P003R001A013
22 -S004C002P008R001A009
23 -S004C002P020R001A003
24 -S004C002P020R001A004
25 -S004C002P020R001A012
26 -S004C002P020R001A020
27 -S004C002P020R001A021
28 -S004C002P020R001A036
29 -S005C002P004R001A001
30 -S005C002P004R001A003
31 -S005C002P010R001A016
32 -S005C002P010R001A017
33 -S005C002P010R001A048
34 -S005C002P010R001A049
35 -S005C002P016R001A009
36 -S005C002P016R001A010
37 -S005C002P018R001A003
38 -S005C002P018R001A028
39 -S005C002P018R001A029
40 -S005C003P016R002A009
41 -S005C003P018R002A013
42 -S005C003P021R002A057
43 -S006C001P001R002A055
44 -S006C002P007R001A005
45 -S006C002P007R001A006
46 -S006C002P016R001A043
47 -S006C002P016R001A051
48 -S006C002P016R001A052
49 -S006C002P022R001A012
50 -S006C002P023R001A020
51 -S006C002P023R001A021
52 -S006C002P023R001A022
53 -S006C002P023R001A023
54 -S006C002P024R001A018
55 -S006C002P024R001A019
56 -S006C003P001R002A013
57 -S006C003P007R002A009
58 -S006C003P007R002A010
59 -S006C003P007R002A025
60 -S006C003P016R001A060
61 -S006C003P017R001A055
62 -S006C003P017R002A013
63 -S006C003P017R002A014
64 -S006C003P017R002A015
65 -S006C003P022R002A013
66 -S007C001P018R002A050
67 -S007C001P025R002A051
68 -S007C001P028R001A050
69 -S007C001P028R001A051
70 -S007C001P028R001A052
71 -S007C002P008R002A008
72 -S007C002P015R002A055
73 -S007C002P026R001A008
74 -S007C002P026R001A009
75 -S007C002P026R001A010
76 -S007C002P026R001A011
77 -S007C002P026R001A012
78 -S007C002P026R001A050
79 -S007C002P027R001A011
80 -S007C002P027R001A013
81 -S007C002P028R002A055
82 -S007C003P007R001A002
83 -S007C003P007R001A004
84 -S007C003P019R001A060
85 -S007C003P027R002A001
86 -S007C003P027R002A002
87 -S007C003P027R002A003
88 -S007C003P027R002A004
89 -S007C003P027R002A005
90 -S007C003P027R002A006
91 -S007C003P027R002A007
92 -S007C003P027R002A008
93 -S007C003P027R002A009
94 -S007C003P027R002A010
95 -S007C003P027R002A011
96 -S007C003P027R002A012
97 -S007C003P027R002A013
98 -S008C002P001R001A009
99 -S008C002P001R001A010
100 -S008C002P001R001A014
101 -S008C002P001R001A015
102 -S008C002P001R001A016
103 -S008C002P001R001A018
104 -S008C002P001R001A019
105 -S008C002P008R002A059
106 -S008C002P025R001A060
107 -S008C002P029R001A004
108 -S008C002P031R001A005
109 -S008C002P031R001A006
110 -S008C002P032R001A018
111 -S008C002P034R001A018
112 -S008C002P034R001A019
113 -S008C002P035R001A059
114 -S008C002P035R002A002
115 -S008C002P035R002A005
116 -S008C003P007R001A009
117 -S008C003P007R001A016
118 -S008C003P007R001A017
119 -S008C003P007R001A018
120 -S008C003P007R001A019
121 -S008C003P007R001A020
122 -S008C003P007R001A021
123 -S008C003P007R001A022
124 -S008C003P007R001A023
125 -S008C003P007R001A025
126 -S008C003P007R001A026
127 -S008C003P007R001A028
128 -S008C003P007R001A029
129 -S008C003P007R002A003
130 -S008C003P008R002A050
131 -S008C003P025R002A002
132 -S008C003P025R002A011
133 -S008C003P025R002A012
134 -S008C003P025R002A016
135 -S008C003P025R002A020
136 -S008C003P025R002A022
137 -S008C003P025R002A023
138 -S008C003P025R002A030
139 -S008C003P025R002A031
140 -S008C003P025R002A032
141 -S008C003P025R002A033
142 -S008C003P025R002A049
143 -S008C003P025R002A060
144 -S008C003P031R001A001
145 -S008C003P031R002A004
146 -S008C003P031R002A014
147 -S008C003P031R002A015
148 -S008C003P031R002A016
149 -S008C003P031R002A017
150 -S008C003P032R002A013
151 -S008C003P033R002A001
152 -S008C003P033R002A011
153 -S008C003P033R002A012
154 -S008C003P034R002A001
155 -S008C003P034R002A012
156 -S008C003P034R002A022
157 -S008C003P034R002A023
158 -S008C003P034R002A024
159 -S008C003P034R002A044
160 -S008C003P034R002A045
161 -S008C003P035R002A016
162 -S008C003P035R002A017
163 -S008C003P035R002A018
164 -S008C003P035R002A019
165 -S008C003P035R002A020
166 -S008C003P035R002A021
167 -S009C002P007R001A001
168 -S009C002P007R001A003
169 -S009C002P007R001A014
170 -S009C002P008R001A014
171 -S009C002P015R002A050
172 -S009C002P016R001A002
173 -S009C002P017R001A028
174 -S009C002P017R001A029
175 -S009C003P017R002A030
176 -S009C003P025R002A054
177 -S010C001P007R002A020
178 -S010C002P016R002A055
179 -S010C002P017R001A005
180 -S010C002P017R001A018
181 -S010C002P017R001A019
182 -S010C002P019R001A001
183 -S010C002P025R001A012
184 -S010C003P007R002A043
185 -S010C003P008R002A003
186 -S010C003P016R001A055
187 -S010C003P017R002A055
188 -S011C001P002R001A008
189 -S011C001P018R002A050
190 -S011C002P008R002A059
191 -S011C002P016R002A055
192 -S011C002P017R001A020
193 -S011C002P017R001A021
194 -S011C002P018R002A055
195 -S011C002P027R001A009
196 -S011C002P027R001A010
197 -S011C002P027R001A037
198 -S011C003P001R001A055
199 -S011C003P002R001A055
200 -S011C003P008R002A012
201 -S011C003P015R001A055
202 -S011C003P016R001A055
203 -S011C003P019R001A055
204 -S011C003P025R001A055
205 -S011C003P028R002A055
206 -S012C001P019R001A060
207 -S012C001P019R002A060
208 -S012C002P015R001A055
209 -S012C002P017R002A012
210 -S012C002P025R001A060
211 -S012C003P008R001A057
212 -S012C003P015R001A055
213 -S012C003P015R002A055
214 -S012C003P016R001A055
215 -S012C003P017R002A055
216 -S012C003P018R001A055
217 -S012C003P018R001A057
218 -S012C003P019R002A011
219 -S012C003P019R002A012
220 -S012C003P025R001A055
221 -S012C003P027R001A055
222 -S012C003P027R002A009
223 -S012C003P028R001A035
224 -S012C003P028R002A055
225 -S013C001P015R001A054
226 -S013C001P017R002A054
227 -S013C001P018R001A016
228 -S013C001P028R001A040
229 -S013C002P015R001A054
230 -S013C002P017R002A054
231 -S013C002P028R001A040
232 -S013C003P008R002A059
233 -S013C003P015R001A054
234 -S013C003P017R002A054
235 -S013C003P025R002A022
236 -S013C003P027R001A055
237 -S013C003P028R001A040
238 -S014C001P027R002A040
239 -S014C002P015R001A003
240 -S014C002P019R001A029
241 -S014C002P025R002A059
242 -S014C002P027R002A040
243 -S014C002P039R001A050
244 -S014C003P007R002A059
245 -S014C003P015R002A055
246 -S014C003P019R002A055
247 -S014C003P025R001A048
248 -S014C003P027R002A040
249 -S015C001P008R002A040
250 -S015C001P016R001A055
251 -S015C001P017R001A055
252 -S015C001P017R002A055
253 -S015C002P007R001A059
254 -S015C002P008R001A003
255 -S015C002P008R001A004
256 -S015C002P008R002A040
257 -S015C002P015R001A002
258 -S015C002P016R001A001
259 -S015C002P016R002A055
260 -S015C003P008R002A007
261 -S015C003P008R002A011
262 -S015C003P008R002A012
263 -S015C003P008R002A028
264 -S015C003P008R002A040
265 -S015C003P025R002A012
266 -S015C003P025R002A017
267 -S015C003P025R002A020
268 -S015C003P025R002A021
269 -S015C003P025R002A030
270 -S015C003P025R002A033
271 -S015C003P025R002A034
272 -S015C003P025R002A036
273 -S015C003P025R002A037
274 -S015C003P025R002A044
275 -S016C001P019R002A040
276 -S016C001P025R001A011
277 -S016C001P025R001A012
278 -S016C001P025R001A060
279 -S016C001P040R001A055
280 -S016C001P040R002A055
281 -S016C002P008R001A011
282 -S016C002P019R002A040
283 -S016C002P025R002A012
284 -S016C003P008R001A011
285 -S016C003P008R002A002
286 -S016C003P008R002A003
287 -S016C003P008R002A004
288 -S016C003P008R002A006
289 -S016C003P008R002A009
290 -S016C003P019R002A040
291 -S016C003P039R002A016
292 -S017C001P016R002A031
293 -S017C002P007R001A013
294 -S017C002P008R001A009
295 -S017C002P015R001A042
296 -S017C002P016R002A031
297 -S017C002P016R002A055
298 -S017C003P007R002A013
299 -S017C003P008R001A059
300 -S017C003P016R002A031
301 -S017C003P017R001A055
302 -S017C003P020R001A059
...\ No newline at end of file ...\ No newline at end of file
1 1
2 %your motion_patch location 2 %your motion_patch location
3 -ori = imread('/home/rfj/바탕화면/actionGAN/motion_patch/S001C001P001R001A020.png'); 3 +ori = imread('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch/sample_111.png');
4 ori = im2double(ori); 4 ori = im2double(ori);
5 ori = ori(:,:,:); 5 ori = ori(:,:,:);
6 6
......
1 +clear;
1 2
2 -%missing file delete
3 -%LOCATION : raw skeletone files
4 path_name = '/media/rfj/EEA4441FA443E923/nturgb_skeletones/'; 3 path_name = '/media/rfj/EEA4441FA443E923/nturgb_skeletones/';
5 -file_list = dir(path_name); 4 +fileID = fopen('/home/rfj/바탕화면/actionGAN/skeletone_INDEX/good_stand_2.txt','r');
6 -L = length(file_list);
7 -
8 -fileID = fopen('/home/rfj/MATLAB/bin/samples_with_missing_skeletons.txt','r');
9 formatSpec = '%s'; 5 formatSpec = '%s';
10 -sizeA = [20 Inf]; 6 +sizeA = [20 Inf];
11 -missing_file_list = fscanf(fileID,formatSpec,sizeA); 7 +perfect_list = fscanf(fileID,formatSpec,sizeA);
12 -missing_file_list = missing_file_list.'; 8 +perfect_list = perfect_list.';
13 fclose(fileID); 9 fclose(fileID);
14 10
15 -perfect_list = [];
16 -
17 -for K = 3:L
18 - file_name = char(file_list(K).name);
19 - missing_num = 0;
20 -
21 - for J = 1:length(missing_file_list);
22 - missing_name = missing_file_list(J,:);
23 - if file_name(1:20) == missing_name
24 - missing_num = 1;
25 - end
26 - end
27 -
28 - if missing_num == 0
29 - perfect_list = [perfect_list;file_name];
30 - end
31 -
32 -end
33 -
34 -% make motion patch
35 -
36 L = length(perfect_list); 11 L = length(perfect_list);
37 12
38 for K = 1:L 13 for K = 1:L
14 +
39 file_name = char(perfect_list(K,:)); 15 file_name = char(perfect_list(K,:));
40 name = strcat(path_name,file_name(1:20),'.skeleton'); 16 name = strcat(path_name,file_name(1:20),'.skeleton');
41 - num_body = file_name(22);
42 - BN = str2num(num_body);
43 [token,remainder] = strtok(file_name,'A'); 17 [token,remainder] = strtok(file_name,'A');
44 class = str2num(remainder(2:4)); 18 class = str2num(remainder(2:4));
45 - 19 +
46 - if class == 20 20 + bodyinfo = read_skeleton_file(name);
47 - bodyinfo = read_skeleton_file(name); 21 + frame_num = size(bodyinfo,2);
48 - frame_num = size(bodyinfo,2); 22 + try
49 -
50 %initialize 23 %initialize
51 cur_subject_x = zeros(frame_num, 25); 24 cur_subject_x = zeros(frame_num, 25);
52 cur_subject_y = zeros(frame_num, 25); 25 cur_subject_y = zeros(frame_num, 25);
...@@ -60,131 +33,149 @@ for K = 1:L ...@@ -60,131 +33,149 @@ for K = 1:L
60 joint_9 = zeros(1,3); 33 joint_9 = zeros(1,3);
61 joint_1 = zeros(1,3); 34 joint_1 = zeros(1,3);
62 joint_3 = zeros(1,3); 35 joint_3 = zeros(1,3);
63 - 36 +
64 - try 37 + %get total joints information
65 - %get total joints information 38 + for FN = 1:frame_num
66 - for FN = 1:frame_num 39 + cur_body = bodyinfo(FN).bodies(1);
67 - cur_body = bodyinfo(FN).bodies(1); 40 + joints = cur_body.joints;
68 - joints = cur_body.joints; 41 +
42 + for JN = 1:25
43 + tot_x(FN,JN) = joints(JN).x;
44 + tot_y(FN,JN) = joints(JN).y;
45 + tot_z(FN,JN) = joints(JN).z;
46 + end
47 + end
48 +
49 + %Orientation normalization 1 : in space
50 + %get median values
51 + M_x = median(tot_x);
52 + M_y = median(tot_y);
53 + M_z = median(tot_z);
54 +
55 + %set 3 points for make plane
56 + joint_5 = [M_x(5) M_y(5) M_z(5)];
57 + joint_9 = [M_x(9) M_y(9) M_z(9)];
58 + joint_1 = [M_x(1) M_y(1) M_z(1)];
59 + joint_3 = [M_x(3) M_y(3) M_z(3)];
60 +
61 + %find RIGID TRNASFORMATION matrix
62 + d1 = joint_1 - joint_5;
63 + d2 = joint_1 - joint_9;
64 + n1 = cross(d1,d2); % because we will parallel transform, don't need to find belly
65 + u1 = n1/norm(n1);
66 + u2 = [0 0 1];
67 + cs1 = dot(u1,u2)/norm(u1)*norm(u2);
68 + ss1 = sqrt(1-cs1.^2);
69 + v1 = cross(u1,u2)/norm(cross(u1,u2));
70 +
71 + R1 = [v1(1)*v1(1)*(1-cs1)+cs1 v1(1)*v1(2)*(1-cs1)-v1(3)*ss1 v1(1)*v1(3)*(1-cs1)+v1(2)*ss1];
72 + R1(2,:) = [v1(1)*v1(2)*(1-cs1)+v1(3)*ss1 v1(2)*v1(2)*(1-cs1)+cs1 v1(2)*v1(3)*(1-cs1)-v1(1)*ss1];
73 + R1(3,:) = [v1(1)*v1(3)*(1-cs1)-v1(2)*ss1 v1(2)*v1(3)*(1-cs1)+v1(1)*ss1 v1(3)*v1(3)*(1-cs1)+cs1];
74 +
75 + %1-3 number tolls to parallel x axis. Rigid transformation on plane surface
76 + %Z axis coords oyler angle transform
77 +
78 + t = joint_3 - joint_1;
79 + d3 = R1(1,:) * t.';
80 + d3(1,2) = R1(2,:) * t.';
81 + d3(1,3) = R1(3,:) * t.';
82 +
83 + u3 = d3(1:2)/norm(d3(1:2));
84 + v3 = [u3(1) -u3(2)];
85 + v3(2,:) = [u3(2) u3(1)];
86 + u4 = [1 0].';
87 +
88 + csss = v3\u4;
89 + cs2 = csss(1);
90 + ss2 = csss(2);
91 +
92 + R2 = [cs2 -ss2 0];
93 + R2(2,:) = [ss2 cs2 0];
94 + R2(3,:) = [0 0 1];
95 +
96 +
97 + %apply rigid transformation
98 + for FN = 1:frame_num
99 + cur_body = bodyinfo(FN).bodies(1);
100 + joints = cur_body.joints;
101 +
102 + for JN = 1:25
103 + a = R1(1,:) * [joints(JN).x joints(JN).y joints(JN).z].';
104 + b = R1(2,:) * [joints(JN).x joints(JN).y joints(JN).z].';
105 + c = R1(3,:) * [joints(JN).x joints(JN).y joints(JN).z].';
106 +
107 + cur_subject_x(FN,JN) = R2(1,:) * [a b c].';
108 + cur_subject_y(FN,JN) = R2(2,:) * [a b c].';
109 + cur_subject_z(FN,JN) = R2(3,:) * [a b c].';
69 110
70 - for JN = 1:25 111 + end
71 - tot_x(FN,JN) = joints(JN).x; 112 + end
72 - tot_y(FN,JN) = joints(JN).y; 113 +
73 - tot_z(FN,JN) = joints(JN).z; 114 + %orientation normalize 2 in plane surface
74 - end 115 + if cur_subject_x(1,4) < cur_subject_x(1,1)
116 + cur_subject_x = 0 - cur_subject_x;
117 + end
118 +
119 + if cur_subject_y(1,9) > cur_subject_y(1,5)
120 + cur_subject_y = 0 - cur_subject_y;
121 + end
122 +
123 + % for save origin subjects before data augment
124 + clear_subject_x = cur_subject_x;
125 + clear_subject_y = cur_subject_y;
126 + clear_subject_z = cur_subject_z;
127 +
128 + % Left <-> Right Change : 2option
129 + for LR = 1:2
130 + if LR == 1
131 + augment_y = clear_subject_y;
132 + else
133 + augment_y = 0 - clear_subject_y;
75 end 134 end
76 135
77 - %get median values 136 + %Height change : 3option
78 - M_x = median(tot_x); 137 + for HE = 1:3
79 - M_y = median(tot_y); 138 + if HE == 1
80 - M_z = median(tot_z); 139 + augment_x = clear_subject_x.* 1.2;
81 - 140 + elseif HE==2
82 - 141 + augment_x = clear_subject_x.* 1.0;
83 - %set 3 points for make plane 142 + else
84 - joint_5 = [M_x(5) M_y(5) M_z(5)]; 143 + augment_x = clear_subject_x.* 0.8;
85 - joint_9 = [M_x(9) M_y(9) M_z(9)]; 144 + end
86 - joint_1 = [M_x(1) M_y(1) M_z(1)];
87 - joint_3 = [M_x(3) M_y(3) M_z(3)];
88 -
89 - %find RIGID TRNASFORMATION matrix
90 - d1 = joint_1 - joint_5;
91 - d2 = joint_1 - joint_9;
92 - n1 = cross(d1,d2); % because we will parallel transform, don't need to find belly
93 - u1 = n1/norm(n1);
94 - u2 = [0 0 1];
95 - cs1 = dot(u1,u2)/norm(u1)*norm(u2);
96 - ss1 = sqrt(1-cs1.^2);
97 - v1 = cross(u1,u2)/norm(cross(u1,u2));
98 -
99 - R1 = [v1(1)*v1(1)*(1-cs1)+cs1 v1(1)*v1(2)*(1-cs1)-v1(3)*ss1 v1(1)*v1(3)*(1-cs1)+v1(2)*ss1];
100 - R1(2,:) = [v1(1)*v1(2)*(1-cs1)+v1(3)*ss1 v1(2)*v1(2)*(1-cs1)+cs1 v1(2)*v1(3)*(1-cs1)-v1(1)*ss1];
101 - R1(3,:) = [v1(1)*v1(3)*(1-cs1)-v1(2)*ss1 v1(2)*v1(3)*(1-cs1)+v1(1)*ss1 v1(3)*v1(3)*(1-cs1)+cs1];
102 -
103 - %1-3 number tolls to parallel x axis. Rigid transformation on plane surface
104 - %Z axis coords oyler angle transform
105 -
106 - t = joint_3 - joint_1;
107 - d3 = R1(1,:) * t.';
108 - d3(1,2) = R1(2,:) * t.';
109 - d3(1,3) = R1(3,:) * t.';
110 -
111 - u3 = d3(1:2)/norm(d3(1:2));
112 - v3 = [u3(1) -u3(2)];
113 - v3(2,:) = [u3(2) u3(1)];
114 - u4 = [1 0].';
115 -
116 - csss = v3\u4;
117 - cs2 = csss(1);
118 - ss2 = csss(2);
119 -
120 - R2 = [cs2 -ss2 0];
121 - R2(2,:) = [ss2 cs2 0];
122 - R2(3,:) = [0 0 1];
123 -
124 -
125 - %apply rigid transformation
126 - for FN = 1:frame_num
127 - cur_body = bodyinfo(FN).bodies(1);
128 - joints = cur_body.joints;
129 145
130 - for JN = 1:25 146 + %Give Gaussian Random Variable : 0.01 - 6times
131 - a = R1(1,:) * [joints(JN).x joints(JN).y joints(JN).z].'; 147 + for RV = 1:6
132 - b = R1(2,:) * [joints(JN).x joints(JN).y joints(JN).z].'; 148 + %3. Gaussian Random filter 0.1
133 - c = R1(3,:) * [joints(JN).x joints(JN).y joints(JN).z].'; 149 + cur_subject_x = augment_x + 0.01.*randn(frame_num,25);
150 + cur_subject_y = augment_y + 0.01.*randn(frame_num,25);
151 + cur_subject_z = clear_subject_z + 0.01.*randn(frame_num,25);
152 +
153 + % NORMALIZATION
154 + cur_subject_x = cur_subject_x - min(cur_subject_x(:));
155 + max_tall = max(cur_subject_x(:));
156 + cur_subject_x = cur_subject_x ./ max_tall;
157 +
158 + cur_subject_y = cur_subject_y - min(cur_subject_y(:));
159 + cur_subject_y = cur_subject_y ./ max_tall;
160 +
161 + cur_subject_z = cur_subject_z - min(cur_subject_z(:));
162 + cur_subject_z = cur_subject_z ./ max_tall;
134 163
135 - cur_subject_x(FN,JN) = R2(1,:) * [a b c].'; 164 +
136 - cur_subject_y(FN,JN) = R2(2,:) * [a b c].'; 165 + %Write image
137 - cur_subject_z(FN,JN) = R2(3,:) * [a b c].'; 166 + motionpatch = cur_subject_x;
167 + motionpatch(:,:,2) = cur_subject_y;
168 + motionpatch(:,:,3) = cur_subject_z;
169 +
170 + new_file_name = strcat('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch/',file_name(1:20),'_',num2str(LR),num2str(HE),num2str(RV),'.png');
171 + imwrite(motionpatch,new_file_name);
138 172
139 end 173 end
140 end 174 end
141 -
142 - %orientation normalize 2 (with plane surface)
143 - if cur_subject_x(1,4) < cur_subject_x(1,1)
144 - cur_subject_x = 0 - cur_subject_x;
145 - end
146 -
147 - if cur_subject_y(1,9) > cur_subject_y(1,5)
148 - cur_subject_y = 0 - cur_subject_y;
149 - end
150 -
151 - %get current median
152 - CM_x=median(cur_subject_x);
153 - CM_y=median(cur_subject_y);
154 - CM_z=median(cur_subject_z);
155 -
156 - %for transform bellybutton to 0.5,0.5 (Except X) but it doesn't work
157 - belly_button = 0.5 - CM_y(2);
158 - belly_button(2) = 0.5 - CM_z(2);
159 -
160 - % normalize with x... <- HERE! WANT TO PARALLEL TRANSFORM
161 - ... but if I plus belly_button for x and y axis , it dosn't work
162 - cur_subject_x = cur_subject_x - min(cur_subject_x(:));
163 - max_tall = max(cur_subject_x(:));
164 - cur_subject_x = cur_subject_x ./ max_tall;
165 -
166 - cur_subject_y = cur_subject_y - min(cur_subject_y(:));
167 - cur_subject_y = cur_subject_y ./ max_tall;
168 -
169 - cur_subject_z = cur_subject_z - min(cur_subject_z(:));
170 - cur_subject_z = cur_subject_z ./ max_tall;
171 -
172 -
173 - % 이미지 저장
174 - motionpatch = cur_subject_x;
175 - motionpatch(:,:,2) = cur_subject_y;
176 - motionpatch(:,:,3) = cur_subject_z;
177 -
178 -
179 - new_file_name = strcat('/home/rfj/바탕화면/motionpatch/',num2str(class),'/',file_name(1:20),'.png');
180 - imwrite(motionpatch,new_file_name);
181 -
182 - catch
183 - name
184 end 175 end
185 176
177 + catch
178 + name
186 end 179 end
187 -
188 -
189 180
190 end 181 end
......
1 +clear;
2 +
3 +path_name = '/media/rfj/EEA4441FA443E923/nturgb_skeletones/';
4 +fileID = fopen('/home/rfj/바탕화면/actionGAN/skeletone_INDEX/good_stand_2.txt','r');
5 +formatSpec = '%s';
6 +sizeA = [20 Inf];
7 +perfect_list = fscanf(fileID,formatSpec,sizeA);
8 +perfect_list = perfect_list.';
9 +fclose(fileID);
10 +
11 +L = length(perfect_list);
12 +
13 +for K = 1:L
14 +
15 + file_name = char(perfect_list(K,:));
16 + name = strcat(path_name,file_name(1:20),'.skeleton');
17 + [token,remainder] = strtok(file_name,'A');
18 + class = str2num(remainder(2:4));
19 +
20 + bodyinfo = read_skeleton_file(name);
21 + frame_num = size(bodyinfo,2);
22 + try
23 + %initialize
24 + cur_subject_x = zeros(frame_num, 25);
25 + cur_subject_y = zeros(frame_num, 25);
26 + cur_subject_z = zeros(frame_num, 25);
27 +
28 + tot_x = zeros(frame_num,25);
29 + tot_y = zeros(frame_num,25);
30 + tot_z = zeros(frame_num,25);
31 +
32 + joint_5 = zeros(1,3);
33 + joint_9 = zeros(1,3);
34 + joint_1 = zeros(1,3);
35 + joint_3 = zeros(1,3);
36 +
37 + %get total joints information
38 + for FN = 1:frame_num
39 + cur_body = bodyinfo(FN).bodies(1);
40 + joints = cur_body.joints;
41 +
42 + for JN = 1:25
43 + tot_x(FN,JN) = joints(JN).x;
44 + tot_y(FN,JN) = joints(JN).y;
45 + tot_z(FN,JN) = joints(JN).z;
46 + end
47 + end
48 +
49 + %Orientation normalization 1 : in space
50 + %get median values
51 + M_x = median(tot_x);
52 + M_y = median(tot_y);
53 + M_z = median(tot_z);
54 +
55 + %set 3 points for make plane
56 + joint_5 = [M_x(5) M_y(5) M_z(5)];
57 + joint_9 = [M_x(9) M_y(9) M_z(9)];
58 + joint_1 = [M_x(1) M_y(1) M_z(1)];
59 + joint_3 = [M_x(3) M_y(3) M_z(3)];
60 +
61 + %find RIGID TRNASFORMATION matrix
62 + d1 = joint_1 - joint_5;
63 + d2 = joint_1 - joint_9;
64 + n1 = cross(d1,d2); % because we will parallel transform, don't need to find belly
65 + u1 = n1/norm(n1);
66 + u2 = [0 0 1];
67 + cs1 = dot(u1,u2)/norm(u1)*norm(u2);
68 + ss1 = sqrt(1-cs1.^2);
69 + v1 = cross(u1,u2)/norm(cross(u1,u2));
70 +
71 + R1 = [v1(1)*v1(1)*(1-cs1)+cs1 v1(1)*v1(2)*(1-cs1)-v1(3)*ss1 v1(1)*v1(3)*(1-cs1)+v1(2)*ss1];
72 + R1(2,:) = [v1(1)*v1(2)*(1-cs1)+v1(3)*ss1 v1(2)*v1(2)*(1-cs1)+cs1 v1(2)*v1(3)*(1-cs1)-v1(1)*ss1];
73 + R1(3,:) = [v1(1)*v1(3)*(1-cs1)-v1(2)*ss1 v1(2)*v1(3)*(1-cs1)+v1(1)*ss1 v1(3)*v1(3)*(1-cs1)+cs1];
74 +
75 + %1-3 number tolls to parallel x axis. Rigid transformation on plane surface
76 + %Z axis coords oyler angle transform
77 +
78 + t = joint_3 - joint_1;
79 + d3 = R1(1,:) * t.';
80 + d3(1,2) = R1(2,:) * t.';
81 + d3(1,3) = R1(3,:) * t.';
82 +
83 + u3 = d3(1:2)/norm(d3(1:2));
84 + v3 = [u3(1) -u3(2)];
85 + v3(2,:) = [u3(2) u3(1)];
86 + u4 = [1 0].';
87 +
88 + csss = v3\u4;
89 + cs2 = csss(1);
90 + ss2 = csss(2);
91 +
92 + R2 = [cs2 -ss2 0];
93 + R2(2,:) = [ss2 cs2 0];
94 + R2(3,:) = [0 0 1];
95 +
96 +
97 + %apply rigid transformation
98 + for FN = 1:frame_num
99 + cur_body = bodyinfo(FN).bodies(1);
100 + joints = cur_body.joints;
101 +
102 + for JN = 1:25
103 + a = R1(1,:) * [joints(JN).x joints(JN).y joints(JN).z].';
104 + b = R1(2,:) * [joints(JN).x joints(JN).y joints(JN).z].';
105 + c = R1(3,:) * [joints(JN).x joints(JN).y joints(JN).z].';
106 +
107 + cur_subject_x(FN,JN) = R2(1,:) * [a b c].';
108 + cur_subject_y(FN,JN) = R2(2,:) * [a b c].';
109 + cur_subject_z(FN,JN) = R2(3,:) * [a b c].';
110 +
111 + end
112 + end
113 +
114 + %orientation normalize 2 in plane surface
115 + if cur_subject_x(1,4) < cur_subject_x(1,1)
116 + cur_subject_x = 0 - cur_subject_x;
117 + end
118 +
119 + if cur_subject_y(1,9) > cur_subject_y(1,5)
120 + cur_subject_y = 0 - cur_subject_y;
121 + end
122 +
123 + % for save origin subjects before data augment
124 + clear_subject_x = cur_subject_x;
125 + clear_subject_y = cur_subject_y;
126 + clear_subject_z = cur_subject_z;
127 +
128 + % Left <-> Right Change : 2option
129 + for LR = 1:2
130 + if LR == 1
131 + augment_y = clear_subject_y;
132 + else
133 + augment_y = 0 - clear_subject_y;
134 + end
135 +
136 + %Height change : 3option
137 + for HE = 1:3
138 + if HE == 1
139 + augment_x = clear_subject_x.* 1.2;
140 + elseif HE==2
141 + augment_x = clear_subject_x.* 1.0;
142 + else
143 + augment_x = clear_subject_x.* 0.8;
144 + end
145 +
146 + %Give Gaussian Random Variable : 0.01 - 6times
147 + for RV = 1:6
148 + %3. Gaussian Random filter 0.1
149 + cur_subject_x = augment_x + 0.01.*randn(frame_num,25);
150 + cur_subject_y = augment_y + 0.01.*randn(frame_num,25);
151 + cur_subject_z = clear_subject_z + 0.01.*randn(frame_num,25);
152 +
153 + % NORMALIZATION
154 + cur_subject_x = cur_subject_x - min(cur_subject_x(:));
155 + max_tall = max(cur_subject_x(:)) .*2;
156 + cur_subject_x = cur_subject_x ./ max_tall;
157 +
158 + cur_subject_y = cur_subject_y - min(cur_subject_y(:));
159 + cur_subject_y = cur_subject_y ./ max_tall;
160 +
161 + cur_subject_z = cur_subject_z - min(cur_subject_z(:));
162 + cur_subject_z = cur_subject_z ./ max_tall;
163 +
164 +
165 + %Write image
166 + motionpatch = cur_subject_x;
167 + motionpatch(:,:,2) = cur_subject_y;
168 + motionpatch(:,:,3) = cur_subject_z;
169 +
170 + new_file_name = strcat('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch_halfsize/',file_name(1:20),'_',num2str(LR),num2str(HE),num2str(RV),'.png');
171 + imwrite(motionpatch,new_file_name);
172 +
173 + end
174 + end
175 + end
176 +
177 + catch
178 + name
179 + end
180 +
181 +end
1 +clear;
2 +
3 +path_name = '/media/rfj/EEA4441FA443E923/nturgb_skeletones/';
4 +fileID = fopen('/home/rfj/바탕화면/actionGAN/skeletone_INDEX/good_stand_2.txt','r');
5 +formatSpec = '%s';
6 +sizeA = [20 Inf];
7 +perfect_list = fscanf(fileID,formatSpec,sizeA);
8 +perfect_list = perfect_list.';
9 +fclose(fileID);
10 +
11 +L = length(perfect_list);
12 +
13 +for K = 1:L
14 +
15 + file_name = char(perfect_list(K,:));
16 + name = strcat(path_name,file_name(1:20),'.skeleton');
17 + [token,remainder] = strtok(file_name,'A');
18 + class = str2num(remainder(2:4));
19 +
20 + bodyinfo = read_skeleton_file(name);
21 + frame_num = size(bodyinfo,2);
22 + try
23 +
24 + %initialize
25 + cur_subject_x = zeros(frame_num, 25);
26 + cur_subject_y = zeros(frame_num, 25);
27 + cur_subject_z = zeros(frame_num, 25);
28 +
29 + tot_x = zeros(frame_num,25);
30 + tot_y = zeros(frame_num,25);
31 + tot_z = zeros(frame_num,25);
32 +
33 + joint_5 = zeros(1,3);
34 + joint_9 = zeros(1,3);
35 + joint_1 = zeros(1,3);
36 + joint_3 = zeros(1,3);
37 +
38 + %get total joints information
39 + for FN = 1:frame_num
40 + cur_body = bodyinfo(FN).bodies(1);
41 + joints = cur_body.joints;
42 +
43 + for JN = 1:25
44 + tot_x(FN,JN) = joints(JN).x;
45 + tot_y(FN,JN) = joints(JN).y;
46 + tot_z(FN,JN) = joints(JN).z;
47 + end
48 + end
49 +
50 + %Orientation normalization 1 : in space
51 + %get median values
52 + M_x = median(tot_x);
53 + M_y = median(tot_y);
54 + M_z = median(tot_z);
55 +
56 + %set 3 points for make plane
57 + joint_5 = [M_x(5) M_y(5) M_z(5)];
58 + joint_9 = [M_x(9) M_y(9) M_z(9)];
59 + joint_1 = [M_x(1) M_y(1) M_z(1)];
60 + joint_3 = [M_x(3) M_y(3) M_z(3)];
61 +
62 + %find RIGID TRNASFORMATION matrix
63 + d1 = joint_1 - joint_5;
64 + d2 = joint_1 - joint_9;
65 + n1 = cross(d1,d2); % because we will parallel transform, don't need to find belly
66 + u1 = n1/norm(n1);
67 + u2 = [0 0 1];
68 + cs1 = dot(u1,u2)/norm(u1)*norm(u2);
69 + ss1 = sqrt(1-cs1.^2);
70 + v1 = cross(u1,u2)/norm(cross(u1,u2));
71 +
72 + R1 = [v1(1)*v1(1)*(1-cs1)+cs1 v1(1)*v1(2)*(1-cs1)-v1(3)*ss1 v1(1)*v1(3)*(1-cs1)+v1(2)*ss1];
73 + R1(2,:) = [v1(1)*v1(2)*(1-cs1)+v1(3)*ss1 v1(2)*v1(2)*(1-cs1)+cs1 v1(2)*v1(3)*(1-cs1)-v1(1)*ss1];
74 + R1(3,:) = [v1(1)*v1(3)*(1-cs1)-v1(2)*ss1 v1(2)*v1(3)*(1-cs1)+v1(1)*ss1 v1(3)*v1(3)*(1-cs1)+cs1];
75 +
76 + %1-3 number tolls to parallel x axis. Rigid transformation on plane surface
77 + %Z axis coords oyler angle transform
78 +
79 + t = joint_3 - joint_1;
80 + d3 = R1(1,:) * t.';
81 + d3(1,2) = R1(2,:) * t.';
82 + d3(1,3) = R1(3,:) * t.';
83 +
84 + u3 = d3(1:2)/norm(d3(1:2));
85 + v3 = [u3(1) -u3(2)];
86 + v3(2,:) = [u3(2) u3(1)];
87 + u4 = [0 1].'; % decide orientation in plane
88 +
89 + csss = v3\u4;
90 + cs2 = csss(1);
91 + ss2 = csss(2);
92 +
93 + R2 = [cs2 -ss2 0];
94 + R2(2,:) = [ss2 cs2 0];
95 + R2(3,:) = [0 0 1];
96 +
97 +
98 + %apply rigid transformation
99 + for FN = 1:frame_num
100 + cur_body = bodyinfo(FN).bodies(1);
101 + joints = cur_body.joints;
102 +
103 + for JN = 1:25
104 + a = R1(1,:) * [joints(JN).x joints(JN).y joints(JN).z].';
105 + b = R1(2,:) * [joints(JN).x joints(JN).y joints(JN).z].';
106 + c = R1(3,:) * [joints(JN).x joints(JN).y joints(JN).z].';
107 +
108 + cur_subject_x(FN,JN) = R2(1,:) * [a b c].';
109 + cur_subject_y(FN,JN) = R2(2,:) * [a b c].';
110 + cur_subject_z(FN,JN) = R2(3,:) * [a b c].';
111 +
112 + end
113 + end
114 +
115 + %orientation normalize 2 (with plane surface)
116 + if cur_subject_y(1,4) < cur_subject_y(1,1)
117 + cur_subject_y = 0 - cur_subject_y;
118 + end
119 +
120 + if cur_subject_x(1,9) > cur_subject_x(1,5)
121 + cur_subject_x = 0 - cur_subject_x;
122 + end
123 +
124 + % for save origin subjects before data augment
125 + clear_subject_x = cur_subject_x;
126 + clear_subject_y = cur_subject_y;
127 + clear_subject_z = cur_subject_z;
128 +
129 + % Left <-> Right Change : 2option
130 + for LR = 1:2
131 + if LR == 1
132 + augment_x = clear_subject_x;
133 + else
134 + augment_x = 0 - clear_subject_x;
135 + end
136 +
137 + %Height change : 3option
138 + for HE = 1:3
139 + if HE == 1
140 + augment_y = clear_subject_y.* 1.2;
141 + elseif HE==2
142 + augment_y = clear_subject_y.* 1.0;
143 + else
144 + augment_y = clear_subject_y.* 0.8;
145 + end
146 +
147 + %Give Gaussian Random Variable : 0.01 - 6times
148 + for RV = 1:6
149 + %3. Gaussian Random filter 0.1
150 + cur_subject_x = augment_x + 0.01.*randn(frame_num,25);
151 + cur_subject_y = augment_y + 0.01.*randn(frame_num,25);
152 + cur_subject_z = clear_subject_z + 0.01.*randn(frame_num,25);
153 +
154 + % NORMALIZATION
155 + cur_subject_y = cur_subject_y - min(cur_subject_y(:));
156 + max_tall = max(cur_subject_y(:));
157 + cur_subject_y = cur_subject_y ./ max_tall;
158 +
159 + cur_subject_x = cur_subject_x - min(cur_subject_x(:));
160 + cur_subject_x = cur_subject_x ./ max_tall;
161 +
162 + cur_subject_z = cur_subject_z - min(cur_subject_z(:));
163 + cur_subject_z = cur_subject_z ./ max_tall;
164 +
165 +
166 + %Write image
167 + motionpatch = cur_subject_x;
168 + motionpatch(:,:,2) = cur_subject_y;
169 + motionpatch(:,:,3) = cur_subject_z;
170 +
171 + new_file_name = strcat('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch_rotate90/',file_name(1:20),'_',num2str(LR),num2str(HE),num2str(RV),'.png');
172 + imwrite(motionpatch,new_file_name);
173 +
174 + end
175 + end
176 +
177 + end
178 +
179 + catch
180 + name
181 + end
182 +
183 +end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 7
8 clear; 8 clear;
9 9
10 -name = '/home/rfj/바탕화면/skeletones/S001C001P002R002A020.skeleton' 10 +name = '/home/rfj/바탕화면/actionGAN/sample_skeletones/S001C001P001R002A020.skeleton'
11 bodyinfo = read_skeleton_file(name); 11 bodyinfo = read_skeleton_file(name);
12 frame_num = size(bodyinfo,2); 12 frame_num = size(bodyinfo,2);
13 13
...@@ -37,6 +37,7 @@ for FN = 1:frame_num ...@@ -37,6 +37,7 @@ for FN = 1:frame_num
37 end 37 end
38 end 38 end
39 39
40 +%Orientation normalization 1 : in space
40 %get median values 41 %get median values
41 M_x = median(tot_x); 42 M_x = median(tot_x);
42 M_y = median(tot_y); 43 M_y = median(tot_y);
...@@ -109,89 +110,59 @@ end ...@@ -109,89 +110,59 @@ end
109 if cur_subject_y(1,9) > cur_subject_y(1,5) 110 if cur_subject_y(1,9) > cur_subject_y(1,5)
110 cur_subject_y = 0 - cur_subject_y; 111 cur_subject_y = 0 - cur_subject_y;
111 end 112 end
112 -
113 -%get current median
114 -CM_x=median(cur_subject_x);
115 -CM_y=median(cur_subject_y);
116 -CM_z=median(cur_subject_z);
117 -
118 -%for transform bellybutton to 0.5,0.5 (Except X) but it doesn't work
119 -belly_button = 0.5 - CM_y(2);
120 -belly_button(2) = 0.5 - CM_z(2);
121 -
122 -% normalize with x... <- HERE! WANT TO PARALLEL TRANSFORM
123 -... but if I plus belly_button for x and y axis , it dosn't work
124 -cur_subject_x = cur_subject_x - min(cur_subject_x(:));
125 -max_tall = max(cur_subject_x(:));
126 -cur_subject_x = cur_subject_x ./ max_tall;
127 -
128 -cur_subject_y = cur_subject_y - min(cur_subject_y(:));
129 -cur_subject_y = cur_subject_y ./ max_tall;
130 -
131 -cur_subject_z = cur_subject_z - min(cur_subject_z(:));
132 -cur_subject_z = cur_subject_z ./ max_tall;
133 -
134 -
135 -% 이미지 저장
136 -motionpatch = cur_subject_x;
137 -motionpatch(:,:,2) = cur_subject_y;
138 -motionpatch(:,:,3) = cur_subject_z;
139 -
140 -new_file_name = strcat('/home/rfj/바탕화면/sample.png');
141 -imwrite(motionpatch,new_file_name);
142 -
143 -
144 -% read image after write
145 -
146 -ori = imread('/home/rfj/바탕화면/sample.png');
147 -ori = im2double(ori);
148 -ori = ori(:,:,:);
149 113
150 -dx = []; 114 +% for save origin subjects before data augment
151 -dy = []; 115 +clear_subject_x = cur_subject_x;
152 -dz = []; 116 +clear_subject_y = cur_subject_y;
153 - 117 +clear_subject_z = cur_subject_z;
154 -for f = 1:numel(ori(:,1,1)) 118 +
155 - for j = 1:25 119 +% Left <-> Right Change : 2option
156 - dx = [dx;ori(f,j,1)]; 120 +for LR = 1:2
157 - dy = [dy;ori(f,j,2)]; 121 + if LR == 1
158 - dz = [dz;ori(f,j,3)]; 122 + augment_y = clear_subject_y;
123 + else
124 + augment_y = 0 - clear_subject_y;
159 end 125 end
160 -end
161 -
162 -a = [1 0 0]; % Red 척추 1,2,3,4,20
163 -b = [0 0 1]; % Blue 오른팔 8,9,10,11,23,24
164 -c = [0 1 0]; % Green왼팔 5,6,7,21,22 (여기서 5번이 빠짐. 넣고싶으면 나중에 24 joint가 아니라 25 joint로 추가)
165 -d = [1 1 0]; % Yellow 오른다리 16,17,18,19
166 -e = [0 1 1]; % Skyblue 왼다리 12,13,14,15
167 -colors = [a;a;a;a;c;c;c;c;b;b;b;b;e;e;e;e;d;d;d;d;a;c;c;b;b];
168 -
169 -scatter3(dx,dy,dz,100,'filled');
170 -
171 -
172 -connecting_joints= ...
173 - [2 1 21 3 21 5 6 7 21 9 10 11 1 13 14 15 1 17 18 19 2 8 8 12 12];
174 -
175 -for jj=1:25:numel(dx)% 1부터 8개씩 numel = 열갯수..?
176 - current = [];
177 - current(:,1) = dy(jj:jj+24) ;
178 - current(:,2) = dz(jj:jj+24) ;
179 - current(:,3) = dx(jj:jj+24) ;
180 -
181 - scatter3(current(:,1),current(:,2),current(:,3),100,colors(:,:),'filled');
182 126
183 - for j =1:25 127 + %Height change : 3option
184 - k=connecting_joints(j); 128 + for HE = 1:3
185 - line([current(j,1) current(k,1)], [current(j,2) current(k,2)] , [current(j,3) current(k,3)]) 129 + if HE == 1
130 + augment_x = clear_subject_x.* 1.2;
131 + elseif HE==2
132 + augment_x = clear_subject_x.* 1.0;
133 + else
134 + augment_x = clear_subject_x.* 0.8;
135 + end
136 +
137 + %Give Gaussian Random Variable : 0.01 - 6times
138 + for RV = 1:6
139 + %3. Gaussian Random filter 0.1
140 + cur_subject_x = augment_x + 0.01.*randn(frame_num,25);
141 + cur_subject_y = augment_y + 0.01.*randn(frame_num,25);
142 + cur_subject_z = clear_subject_z + 0.01.*randn(frame_num,25);
143 +
144 + % NORMALIZATION
145 + cur_subject_x = cur_subject_x - min(cur_subject_x(:));
146 + max_tall = max(cur_subject_x(:));
147 + cur_subject_x = cur_subject_x ./ max_tall;
148 +
149 + cur_subject_y = cur_subject_y - min(cur_subject_y(:));
150 + cur_subject_y = cur_subject_y ./ max_tall;
151 +
152 + cur_subject_z = cur_subject_z - min(cur_subject_z(:));
153 + cur_subject_z = cur_subject_z ./ max_tall;
154 +
155 +
156 + %Write image
157 + motionpatch = cur_subject_x;
158 + motionpatch(:,:,2) = cur_subject_y;
159 + motionpatch(:,:,3) = cur_subject_z;
160 +
161 + new_file_name = strcat('/home/rfj/바탕화면/actionGAN/DCGAN/new_motionpatch/sample_',num2str(LR),num2str(HE),num2str(RV),'.png');
162 + imwrite(motionpatch,new_file_name);
163 +
164 + end
186 end 165 end
187 166
188 - set(gca,'Xdir','reverse','Ydir','reverse')
189 - xlim([0 1]);
190 - xlabel('x')
191 - ylim([0 1]);
192 - ylabel('y')
193 - zlim([0 1]);
194 - zlabel('z')
195 - drawnow
196 - pause(0.01)
197 -end
...\ No newline at end of file ...\ No newline at end of file
167 +end
168 +
......
This file is too large to display.
This file is too large to display.
This file is too large to display.
This file is too large to display.
...@@ -4,7 +4,6 @@ S001C001P005R002A020 ...@@ -4,7 +4,6 @@ S001C001P005R002A020
4 S001C001P007R001A020 4 S001C001P007R001A020
5 S001C001P008R002A020 5 S001C001P008R002A020
6 S001C002P002R002A020 6 S001C002P002R002A020
7 -S001C001P001R001A020
8 S001C002P003R002A020 7 S001C002P003R002A020
9 S001C002P005R001A020 8 S001C002P005R001A020
10 S001C002P005R002A020 9 S001C002P005R002A020
......