-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate CSV file to actual image #1
Comments
Tien, image = Image.open(image_path)
# convert image to numpy array
image_array = np.array(image)
# flatten into a 1D vector
flattened_image = image_array.flatten() Now after using this data, in GaussianCopulaSynthesizer, you can use the generated CSV file to get the images like this: df = pd.read_csv(generated_csv_path)
image_data = np.array(df.iloc[0]) # for the single image
# reshape the data to its original shape
image_shape = (564, 564, 3) # your actual image size
image_array = image_data.reshape(image_shape)
# convert the numpy array back to an image
image = Image.fromarray(image_array.astype(np.uint8)) I hope this helped. |
Thank you for your explanation. Just want to confirm my understanding. The problem will run as: real image .png file(let's say chest X-ray) => convert to numpy array through your first code => run through GaussianCopulaSynthesizer => generated csv file => run through second code to get synthetic chest X-ray images Please let me know if my understanding is incorrect. Thank you so much |
Dear Helen,
Thank you for this interesting work. I was able to the generate a CSV file using GCSbc models. I wonder if there is a way to convert the .csv file to the actual image. I tried to search around but don't see any options. Thank you so much.
Best,
Tien
The text was updated successfully, but these errors were encountered: