O:\PycharmProjects\catdogtf2.2\venv\Scripts\python.exe O:\PyCharm\plugins\python\helpers\pydev\pydevconsole.py --mode=client --port=63288
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['O:\\PycharmProjects\\catdogtf2.2', 'O:/PycharmProjects/catdogtf2.2'])
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.17.0
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] on win32
runfile('O:/PycharmProjects/catdogtf2.2/009.py', wdir='O:/PycharmProjects/catdogtf2.2')
2020-08-11 23:38:38.375911: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
Downloading data from https://storage.googleapis.com/applied-dl/heart.csv
16384/13273 [=====================================] - 0s 0us/step
2020-08-11 23:38:41.529035: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-08-11 23:38:41.572391: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:09:00.0 name: GeForce RTX 2080 SUPER computeCapability: 7.5
coreClock: 1.845GHz coreCount: 48 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 462.00GiB/s
2020-08-11 23:38:41.572897: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-08-11 23:38:41.585503: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-08-11 23:38:41.592012: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-08-11 23:38:41.595184: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-08-11 23:38:41.602528: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-08-11 23:38:41.607053: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-08-11 23:38:41.619809: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-08-11 23:38:41.620202: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2020-08-11 23:38:41.620769: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-08-11 23:38:41.630669: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2417f28da80 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-08-11 23:38:41.631101: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-08-11 23:38:41.631514: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:09:00.0 name: GeForce RTX 2080 SUPER computeCapability: 7.5
coreClock: 1.845GHz coreCount: 48 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 462.00GiB/s
2020-08-11 23:38:41.631942: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-08-11 23:38:41.632082: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-08-11 23:38:41.632363: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-08-11 23:38:41.632610: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-08-11 23:38:41.632981: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-08-11 23:38:41.633288: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-08-11 23:38:41.633583: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-08-11 23:38:41.633919: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2020-08-11 23:38:42.309719: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-08-11 23:38:42.309959: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
2020-08-11 23:38:42.310107: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
2020-08-11 23:38:42.310492: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6198 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 SUPER, pci bus id: 0000:09:00.0, compute capability: 7.5)
2020-08-11 23:38:42.313704: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2412eb83730 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-08-11 23:38:42.314096: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce RTX 2080 SUPER, Compute Capability 7.5
Features: [ 63. 1. 1. 145. 233. 1. 2. 150. 0. 2.3 3. 0.
2. ], Target: 0
Features: [ 67. 1. 4. 160. 286. 0. 2. 108. 1. 1.5 2. 3.
3. ], Target: 1
Features: [ 67. 1. 4. 120. 229. 0. 2. 129. 1. 2.6 2. 2.
4. ], Target: 0
Features: [ 37. 1. 3. 130. 250. 0. 0. 187. 0. 3.5 3. 0.
3. ], Target: 0
Features: [ 41. 0. 2. 130. 204. 0. 2. 172. 0. 1.4 1. 0.
3. ], Target: 0
Epoch 1/15
WARNING:tensorflow:Layer dense is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.
If you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.
To change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.
2020-08-11 23:38:43.103814: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
303/303 [==============================] - 1s 2ms/step - loss: 1.0260 - accuracy: 0.6832
Epoch 2/15
303/303 [==============================] - 1s 2ms/step - loss: 0.7020 - accuracy: 0.7558
Epoch 3/15
303/303 [==============================] - 1s 3ms/step - loss: 0.6972 - accuracy: 0.7294
Epoch 4/15
303/303 [==============================] - 1s 3ms/step - loss: 0.6353 - accuracy: 0.7294
Epoch 5/15
303/303 [==============================] - 1s 3ms/step - loss: 0.6456 - accuracy: 0.7492
Epoch 6/15
303/303 [==============================] - 1s 2ms/step - loss: 0.6248 - accuracy: 0.7492
Epoch 7/15
303/303 [==============================] - 1s 2ms/step - loss: 0.4927 - accuracy: 0.7855
Epoch 8/15
303/303 [==============================] - 1s 3ms/step - loss: 0.5099 - accuracy: 0.7756
Epoch 9/15
303/303 [==============================] - 1s 2ms/step - loss: 0.5669 - accuracy: 0.7492
Epoch 10/15
303/303 [==============================] - 1s 2ms/step - loss: 0.5558 - accuracy: 0.7888
Epoch 11/15
303/303 [==============================] - 1s 2ms/step - loss: 0.5408 - accuracy: 0.7624
Epoch 12/15
303/303 [==============================] - 1s 2ms/step - loss: 0.4900 - accuracy: 0.7987
Epoch 13/15
303/303 [==============================] - 1s 2ms/step - loss: 0.4866 - accuracy: 0.8053
Epoch 14/15
303/303 [==============================] - 1s 3ms/step - loss: 0.4382 - accuracy: 0.7855
Epoch 15/15
303/303 [==============================] - 1s 3ms/step - loss: 0.4960 - accuracy: 0.7657
({'age': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([63, 67, 67, 37, 41, 56, 62, 57, 63, 53, 57, 56, 56, 44, 52, 57])>, 'sex': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1])>, 'cp': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([1, 4, 4, 3, 2, 2, 4, 4, 4, 4, 4, 2, 3, 2, 3, 3])>, 'trestbps': <tf.Tensor: shape=(16,), dtype=int32, numpy=
array([145, 160, 120, 130, 130, 120, 140, 120, 130, 140, 140, 140, 130,
120, 172, 150])>, 'chol': <tf.Tensor: shape=(16,), dtype=int32, numpy=
array([233, 286, 229, 250, 204, 236, 268, 354, 254, 203, 192, 294, 256,
263, 199, 168])>, 'fbs': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0])>, 'restecg': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([2, 2, 2, 0, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 0, 0])>, 'thalach': <tf.Tensor: shape=(16,), dtype=int32, numpy=
array([150, 108, 129, 187, 172, 178, 160, 163, 147, 155, 148, 153, 142,
173, 162, 174])>, 'exang': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0])>, 'oldpeak': <tf.Tensor: shape=(16,), dtype=float32, numpy=
array([2.3, 1.5, 2.6, 3.5, 1.4, 0.8, 3.6, 0.6, 1.4, 3.1, 0.4, 1.3, 0.6,
0. , 0.5, 1.6], dtype=float32)>, 'slope': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([3, 2, 2, 3, 1, 1, 3, 1, 2, 3, 2, 2, 2, 1, 1, 1])>, 'ca': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([0, 3, 2, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0])>, 'thal': <tf.Tensor: shape=(16,), dtype=int32, numpy=array([2, 3, 4, 3, 3, 3, 3, 3, 4, 4, 2, 3, 2, 4, 4, 3])>}, <tf.Tensor: shape=(16,), dtype=int64, numpy=array([0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0], dtype=int64)>)
Epoch 1/15
19/19 [==============================] - 0s 3ms/step - loss: 167.4701 - accuracy: 0.2739
Epoch 2/15
19/19 [==============================] - 0s 3ms/step - loss: 139.3064 - accuracy: 0.2739
Epoch 3/15
19/19 [==============================] - 0s 3ms/step - loss: 111.9945 - accuracy: 0.2739
Epoch 4/15
19/19 [==============================] - 0s 4ms/step - loss: 84.2170 - accuracy: 0.2739
Epoch 5/15
19/19 [==============================] - 0s 3ms/step - loss: 53.5864 - accuracy: 0.2739
Epoch 6/15
19/19 [==============================] - 0s 3ms/step - loss: 19.6813 - accuracy: 0.3069
Epoch 7/15
19/19 [==============================] - 0s 3ms/step - loss: 3.5970 - accuracy: 0.6766
Epoch 8/15
19/19 [==============================] - 0s 3ms/step - loss: 3.0850 - accuracy: 0.7030
Epoch 9/15
19/19 [==============================] - 0s 3ms/step - loss: 2.6416 - accuracy: 0.6403
Epoch 10/15
19/19 [==============================] - 0s 3ms/step - loss: 2.4151 - accuracy: 0.6766
Epoch 11/15
19/19 [==============================] - 0s 3ms/step - loss: 2.2261 - accuracy: 0.6766
Epoch 12/15
19/19 [==============================] - 0s 3ms/step - loss: 2.0685 - accuracy: 0.6865
Epoch 13/15
19/19 [==============================] - 0s 3ms/step - loss: 1.9093 - accuracy: 0.6865
Epoch 14/15
19/19 [==============================] - 0s 3ms/step - loss: 1.7673 - accuracy: 0.6865
Epoch 15/15
19/19 [==============================] - 0s 3ms/step - loss: 1.6325 - accuracy: 0.6898
import pandas as pd
import tensorflow as tf
csv_file = tf.keras.utils.get_file('heart.csv', 'https://storage.googleapis.com/applied-dl/heart.csv')
df = pd.read_csv(csv_file)
df.head()
df.dtypes
df['thal'] = pd.Categorical(df['thal'])
df['thal'] = df.thal.cat.codes
df.head()
target = df.pop('target')
dataset = tf.data.Dataset.from_tensor_slices((df.values, target.values))
for feat, targ in dataset.take(5):
print('Features: {}, Target: {}'.format(feat, targ))
tf.constant(df['thal'])
train_dataset = dataset.shuffle(len(df)).batch(1)
def get_compiled_model():
model = tf.keras.Sequential([
tf.keras.layers.Dense(10, activation='relu'),
tf.keras.layers.Dense(10, activation='relu'),
tf.keras.layers.Dense(1)
])
model.compile(optimizer='adam',
loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),
metrics=['accuracy'])
return model
model = get_compiled_model()
model.fit(train_dataset, epochs=15)
inputs = {key: tf.keras.layers.Input(shape=(), name=key) for key in df.keys()}
x = tf.stack(list(inputs.values()), axis=-1)
x = tf.keras.layers.Dense(10, activation='relu')(x)
output = tf.keras.layers.Dense(1)(x)
model_func = tf.keras.Model(inputs=inputs, outputs=output)
model_func.compile(optimizer='adam',
loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),
metrics=['accuracy'])
dict_slices = tf.data.Dataset.from_tensor_slices((df.to_dict('list'), target.values)).batch(16)
for dict_slice in dict_slices.take(1):
print(dict_slice)
model_func.fit(dict_slices, epochs=15)
'3D world > AI Integration Engineer' 카테고리의 다른 글
datas (0) | 2020.08.11 |
---|---|
tutorials 10 (0) | 2020.08.11 |
tutorials 08 (0) | 2020.08.11 |
tutorials 07 (0) | 2020.08.11 |
tutorials 06 (0) | 2020.08.11 |
최근댓글