SuihongSong / GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features

Directly Conditional Facies Modeling Using an Improved Progressive Growing of Generative Adversarial Networks (GANs)
Other
16 stars 11 forks source link

Well facies data does not match the actual facies model when reading the dataset #2

Open SiyuLuoX opened 5 months ago

SiyuLuoX commented 5 months ago

tensorflow2.1 python 3.8

Well facies data does not match the actual facies model when reading the dataset.But the facies model and global conditions match. Here is my code

from tensorflow import keras
import tensorflow as tf
import os
import numpy as np
import matplotlib.pyplot as plt

# 定义 TFRecord 文件路径TestData
tfrecord_path = 'DataSets/TrainingData/TrainingData-1r06.tfrecords' # 分辨率最大64*64
wellfacies_path = 'DataSets/TrainingData/TrainingData-3wellfacies.tfrecords' 
label_path = 'DataSets/TrainingData/TrainingData-4rxx.labels'

labels = np.load(label_path)
label_type = [1,2,3]
# 标签数据集处理函数
def load_labels(label):
    # 比例,河道宽度,蜿蜒度
    # return labels[label_type]
    return tf.gather(label,label_type)

def parse_function(record):
    feature_description = {
        'shape': tf.io.FixedLenFeature([3], tf.int64),
        'data': tf.io.FixedLenFeature([], tf.string),
    }
    features = tf.io.parse_single_example(record, feature_description)

    # 获取'shape'特征并转换为NumPy数组
    # shape_array = np.array(features['shape'])
    # print("Shape of 'shape' feature:", shape_array)

    data = tf.io.decode_raw(features['data'], tf.uint8)
    data = tf.reshape(data, features['shape'])
    data = tf.transpose(data, perm=[1,2,0])
    return data

img64_dataset = tf.data.TFRecordDataset(tfrecord_path).map(parse_function)
wellfacies_dataset = tf.data.TFRecordDataset(wellfacies_path).map(parse_function)
label_dataset = tf.data.Dataset.from_tensor_slices(labels).map(load_labels)

# 合并数据集
dataset = tf.data.Dataset.zip((img64_dataset, wellfacies_dataset, label_dataset))
def process_labels(labels):
    # 计算方位角
    # labels[:,0] = (labels[:,0]/2+0.5)*168-84
    # 背景相比例
    labels[0] = (labels[0]/2+0.5)*0.8037109375+0.167724609375
    # 河道宽度
    labels[1] = (labels[1]/2+0.5)*0.8+2.7
    # amplitud/wavelength
    labels[2] = (labels[2]/2+0.5)*0.4866197183098592+0.06338028169014084
    return labels

# 打印示例
num_columns = 2 # 设置子图的列数
fig, axes = plt.subplots(2, num_columns, figsize=(10, 10)) # 创建子图

for i, (image, wellfacie, label) in enumerate(dataset.take(num_columns)):
    label = label.numpy()
    # print(label.shape)
    label = process_labels(label)
    print(f"Image shape: {image.shape}, Label: {label}")
    # 在子图中显示图像
    axes[0,i].imshow(image.numpy())
    axes[0,i].axis('on')  # 可以选择是否显示坐标轴
    axes[1,i].imshow(wellfacie.numpy())
    axes[1,i].axis('on')
# 调整为紧凑布局
fig.tight_layout()
plt.show()

Here's the output graph output

Almost the eighth row of the second chart does not have a river, but it does show a river. May I ask if there is something I am doing incorrectly

SuihongSong commented 5 months ago

Hi Siyu,

Yes, in this version of dataset, we deliberately sample well facies data to make sure they are not 100% consistent with the ground truth facies map, instead well facies data are sampled with a probability to be consistent with the ground truth meaning that some well facies are consistent while some are not. Such a setting is mainly because in this project, we will still have a channel probability map showing the possible location of channels and if the well facies data are just sampl

Suihong Song

@. | ---- Replied Message ---- | From | @.> | | Date | 03/14/2024 00:53 | | To | SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features @.> | | Cc | Subscribed @.> | | Subject | [SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features] Well facies data does not match the actual facies model when reading the dataset (Issue #2) |

tensorflow2.1 python 3.8

Well facies data does not match the actual facies model when reading the dataset.But the facies model and global conditions match. Here is my code

from tensorflow import keras import tensorflow as tf import os import numpy as np import matplotlib.pyplot as plt

定义 TFRecord 文件路径TestData

tfrecord_path = 'DataSets/TrainingData/TrainingData-1r06.tfrecords' # 分辨率最大64*64 wellfacies_path = 'DataSets/TrainingData/TrainingData-3wellfacies.tfrecords' label_path = 'DataSets/TrainingData/TrainingData-4rxx.labels'

labels = np.load(label_path) label_type = [1,2,3]

标签数据集处理函数

def load_labels(label):

比例,河道宽度,蜿蜒度

# return labels[label_type]
return tf.gather(label,label_type)

def parse_function(record): feature_description = { 'shape': tf.io.FixedLenFeature([3], tf.int64), 'data': tf.io.FixedLenFeature([], tf.string), } features = tf.io.parse_single_example(record, feature_description)

# 获取'shape'特征并转换为NumPy数组
# shape_array = np.array(features['shape'])
# print("Shape of 'shape' feature:", shape_array)

data = tf.io.decode_raw(features['data'], tf.uint8)
data = tf.reshape(data, features['shape'])
data = tf.transpose(data, perm=[1,2,0])
return data

img64_dataset = tf.data.TFRecordDataset(tfrecord_path).map(parse_function) wellfacies_dataset = tf.data.TFRecordDataset(wellfacies_path).map(parse_function) label_dataset = tf.data.Dataset.from_tensor_slices(labels).map(load_labels)

合并数据集

dataset = tf.data.Dataset.zip((img64_dataset, wellfacies_dataset, label_dataset))

def process_labels(labels):

计算方位角

# labels[:,0] = (labels[:,0]/2+0.5)*168-84
# 背景相比例
labels[0] = (labels[0]/2+0.5)*0.8037109375+0.167724609375
# 河道宽度
labels[1] = (labels[1]/2+0.5)*0.8+2.7
# amplitud/wavelength
labels[2] = (labels[2]/2+0.5)*0.4866197183098592+0.06338028169014084
return labels

打印示例

num_columns = 2 # 设置子图的列数 fig, axes = plt.subplots(2, num_columns, figsize=(10, 10)) # 创建子图

for i, (image, wellfacie, label) in enumerate(dataset.take(num_columns)): label = label.numpy()

print(label.shape)

label = process_labels(label)
print(f"Image shape: {image.shape}, Label: {label}")
# 在子图中显示图像
axes[0,i].imshow(image.numpy())
axes[0,i].axis('on')  # 可以选择是否显示坐标轴
axes[1,i].imshow(wellfacie.numpy())
axes[1,i].axis('on')

调整为紧凑布局

fig.tight_layout() plt.show()

Here's the output graph output.png (view on web)

Almost the eighth row of the second chart does not have a river, but it does show a river. May I ask if there is something I am doing incorrectly

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

SuihongSong commented 5 months ago

Following the last reply:

If the well facies data are directly sampled from the ground truth facies map, then the well facies information is completely included in the probability map (largest values in probability map), so the neural network may neglect the influence of well data. Of course, since well data are slightly perturbed compare to the direct sampling from the ground truth, the facies data of different wells should not contradict.

Suihong Song

@. | ---- Replied Message ---- | From | @.> | | Date | 03/14/2024 00:53 | | To | SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features @.> | | Cc | Subscribed @.> | | Subject | [SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features] Well facies data does not match the actual facies model when reading the dataset (Issue #2) |

tensorflow2.1 python 3.8

Well facies data does not match the actual facies model when reading the dataset.But the facies model and global conditions match. Here is my code

from tensorflow import keras import tensorflow as tf import os import numpy as np import matplotlib.pyplot as plt

定义 TFRecord 文件路径TestData

tfrecord_path = 'DataSets/TrainingData/TrainingData-1r06.tfrecords' # 分辨率最大64*64 wellfacies_path = 'DataSets/TrainingData/TrainingData-3wellfacies.tfrecords' label_path = 'DataSets/TrainingData/TrainingData-4rxx.labels'

labels = np.load(label_path) label_type = [1,2,3]

标签数据集处理函数

def load_labels(label):

比例,河道宽度,蜿蜒度

# return labels[label_type]
return tf.gather(label,label_type)

def parse_function(record): feature_description = { 'shape': tf.io.FixedLenFeature([3], tf.int64), 'data': tf.io.FixedLenFeature([], tf.string), } features = tf.io.parse_single_example(record, feature_description)

# 获取'shape'特征并转换为NumPy数组
# shape_array = np.array(features['shape'])
# print("Shape of 'shape' feature:", shape_array)

data = tf.io.decode_raw(features['data'], tf.uint8)
data = tf.reshape(data, features['shape'])
data = tf.transpose(data, perm=[1,2,0])
return data

img64_dataset = tf.data.TFRecordDataset(tfrecord_path).map(parse_function) wellfacies_dataset = tf.data.TFRecordDataset(wellfacies_path).map(parse_function) label_dataset = tf.data.Dataset.from_tensor_slices(labels).map(load_labels)

合并数据集

dataset = tf.data.Dataset.zip((img64_dataset, wellfacies_dataset, label_dataset))

def process_labels(labels):

计算方位角

# labels[:,0] = (labels[:,0]/2+0.5)*168-84
# 背景相比例
labels[0] = (labels[0]/2+0.5)*0.8037109375+0.167724609375
# 河道宽度
labels[1] = (labels[1]/2+0.5)*0.8+2.7
# amplitud/wavelength
labels[2] = (labels[2]/2+0.5)*0.4866197183098592+0.06338028169014084
return labels

打印示例

num_columns = 2 # 设置子图的列数 fig, axes = plt.subplots(2, num_columns, figsize=(10, 10)) # 创建子图

for i, (image, wellfacie, label) in enumerate(dataset.take(num_columns)): label = label.numpy()

print(label.shape)

label = process_labels(label)
print(f"Image shape: {image.shape}, Label: {label}")
# 在子图中显示图像
axes[0,i].imshow(image.numpy())
axes[0,i].axis('on')  # 可以选择是否显示坐标轴
axes[1,i].imshow(wellfacie.numpy())
axes[1,i].axis('on')

调整为紧凑布局

fig.tight_layout() plt.show()

Here's the output graph output.png (view on web)

Almost the eighth row of the second chart does not have a river, but it does show a river. May I ask if there is something I am doing incorrectly

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

SuihongSong commented 5 months ago

Following the last reply:

In our latest version, we add a small random noise into the probability map, and the well facies data are directly sampled from the ground truth facies map.

Suihong Song

@. | ---- Replied Message ---- | From | @.> | | Date | 03/14/2024 00:53 | | To | SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features @.> | | Cc | Subscribed @.> | | Subject | [SuihongSong/GeoModeling_GANSim-2D_Condition_to_Well_Facies_and_Global_Features] Well facies data does not match the actual facies model when reading the dataset (Issue #2) |

tensorflow2.1 python 3.8

Well facies data does not match the actual facies model when reading the dataset.But the facies model and global conditions match. Here is my code

from tensorflow import keras import tensorflow as tf import os import numpy as np import matplotlib.pyplot as plt

定义 TFRecord 文件路径TestData

tfrecord_path = 'DataSets/TrainingData/TrainingData-1r06.tfrecords' # 分辨率最大64*64 wellfacies_path = 'DataSets/TrainingData/TrainingData-3wellfacies.tfrecords' label_path = 'DataSets/TrainingData/TrainingData-4rxx.labels'

labels = np.load(label_path) label_type = [1,2,3]

标签数据集处理函数

def load_labels(label):

比例,河道宽度,蜿蜒度

# return labels[label_type]
return tf.gather(label,label_type)

def parse_function(record): feature_description = { 'shape': tf.io.FixedLenFeature([3], tf.int64), 'data': tf.io.FixedLenFeature([], tf.string), } features = tf.io.parse_single_example(record, feature_description)

# 获取'shape'特征并转换为NumPy数组
# shape_array = np.array(features['shape'])
# print("Shape of 'shape' feature:", shape_array)

data = tf.io.decode_raw(features['data'], tf.uint8)
data = tf.reshape(data, features['shape'])
data = tf.transpose(data, perm=[1,2,0])
return data

img64_dataset = tf.data.TFRecordDataset(tfrecord_path).map(parse_function) wellfacies_dataset = tf.data.TFRecordDataset(wellfacies_path).map(parse_function) label_dataset = tf.data.Dataset.from_tensor_slices(labels).map(load_labels)

合并数据集

dataset = tf.data.Dataset.zip((img64_dataset, wellfacies_dataset, label_dataset))

def process_labels(labels):

计算方位角

# labels[:,0] = (labels[:,0]/2+0.5)*168-84
# 背景相比例
labels[0] = (labels[0]/2+0.5)*0.8037109375+0.167724609375
# 河道宽度
labels[1] = (labels[1]/2+0.5)*0.8+2.7
# amplitud/wavelength
labels[2] = (labels[2]/2+0.5)*0.4866197183098592+0.06338028169014084
return labels

打印示例

num_columns = 2 # 设置子图的列数 fig, axes = plt.subplots(2, num_columns, figsize=(10, 10)) # 创建子图

for i, (image, wellfacie, label) in enumerate(dataset.take(num_columns)): label = label.numpy()

print(label.shape)

label = process_labels(label)
print(f"Image shape: {image.shape}, Label: {label}")
# 在子图中显示图像
axes[0,i].imshow(image.numpy())
axes[0,i].axis('on')  # 可以选择是否显示坐标轴
axes[1,i].imshow(wellfacie.numpy())
axes[1,i].axis('on')

调整为紧凑布局

fig.tight_layout() plt.show()

Here's the output graph output.png (view on web)

Almost the eighth row of the second chart does not have a river, but it does show a river. May I ask if there is something I am doing incorrectly

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

SiyuLuoX commented 5 months ago

Hi, I'm very sorry to bother you again, I didn't find the new version you mentioned. If you can, could you please give me a download link? Appreciate it!

SuihongSong commented 5 months ago

Hi Siyu, Yes, I can share you. download from the following google drive link: https://drive.google.com/file/d/1Fqdz4Vavrb4_qEzWtPnd9FV9VEFdLJ6r/view?usp=sharing

Thanks, Suihong