diff --git a/VITON-Extends-Train/data/__pycache__/__init__.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..750bf5a059fd664facd1b3c1bf312b28fa99bf39 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/__init__.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/__init__.cpython-37.pyc b/VITON-Extends-Train/data/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b0a9e05358f2199b90bee2b69bd2e4d93c03ba3 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/__init__.cpython-37.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/base_data_loader.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/base_data_loader.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e002a233c807a095f1493bab003d1b0a6fbdcb2 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/base_data_loader.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1874d9f8e4987e51b02332232f5430eef3560c3c Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader_test.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader_test.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61ac5f7b8173530180db0948024163cabc3d3bf1 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/custom_dataset_data_loader_test.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/data_loader.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/data_loader.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb37d9c15f5a633b55cb75b85a4ca10071060af8 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/data_loader.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/data_loader_test.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/data_loader_test.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..373681f4ddd1fac8a9fd761ef4447a9d71148180 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/data_loader_test.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/image_folder.cpython-36.pyc b/VITON-Extends-Train/data/__pycache__/image_folder.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40a45b999c0d13c732fb9855f4c202c1567788a5 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/image_folder.cpython-36.pyc differ diff --git a/VITON-Extends-Train/data/__pycache__/image_folder.cpython-37.pyc b/VITON-Extends-Train/data/__pycache__/image_folder.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11311da6a6c8a45429aa4138f29064f669c03ab3 Binary files /dev/null and b/VITON-Extends-Train/data/__pycache__/image_folder.cpython-37.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/__init__.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..465fdaac9087a8cec42554530385727f0d8f4d58 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/__init__.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/__init__.cpython-37.pyc b/VITON-Extends-Train/models/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40c5b68aed4f2882583c0cb4c15131492f13c4ea Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/__init__.cpython-37.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/afwm.cpython-37.pyc b/VITON-Extends-Train/models/__pycache__/afwm.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70e40abe0f7aa35dcf7b16f67616e0f76d3c0758 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/afwm.cpython-37.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/base_model.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/base_model.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9127e110a78dd69adfbe2ea06801a27c49f37fdb Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/base_model.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b80a7aedff75c2dfabe3988c1b9f197bf1c3166 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_add.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_add.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85174ad2ffb67596a4b47eab087688c9faff85a1 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_add.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68a5bd4e2aa2f74c860bf3bcd0974de705d449fb Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_add.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_add.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c03b757f69cc7feba945f4abe13a925fc8e635e Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_add.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5d39894a05a6b6ebf591102f44a4c2eb0ec2753 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_add.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_add.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..37a62f6d21d19f77d3cd4c251d8e188d05c61d74 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_add.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_feat.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_feat.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df10cbc02f235b3fee454c5fc38b2201e0c3dad2 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_feat.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_offset_sep.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_offset_sep.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c05d402b599e71c9571b04fb23f15e41ce4ddc1 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_offset_sep.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_sep.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_sep.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4efa920daa2c7829cb698dcec3cc92fc2708219 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_grid_sep.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_new.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_new.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fff6c24541e5e143a0f3128651fe74b01fa1e2f Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_new.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_offset.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_offset.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26d031224168630cd2b7b97a3f5b107baf943c70 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_offset.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5b804f2f394b1645bf678f7e76f74519f82c6e0c Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..38d853f562e9767e295080e09803896ceb034565 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6ef0cb7eaf12afd05436f840dda25718734769a Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01597f82bc8eebebc9c1d7d3e05ad18259364ca6 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3d2308584a7a67f354b332dfe5c3202e36c69ac Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_heatmap.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_heatmap.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..036d85507b8bda0ee328843b7b22c3e966c83b40 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_heatmap.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_no_refine.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_no_refine.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6bb8a447cba2cec510940d932b6a71160799d081 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_no_refine.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_trans.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_trans.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03e6272ef16da78a9420e725a0e83c1cda2fa4b7 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_revise_new_sep_all_more_trans.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_sep.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_sep.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ffc6edc571aa1421cf07be425352c0176e0efcc Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_more_sep.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_sep.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_sep.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..baceca534d12ca813da92413d5d927456c31251e Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_cor_sep.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_smooth.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_smooth.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c5ac3e49dd9dc25251e3fb76f228db2b82562a6 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_smooth.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/flow_gmm_vis.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/flow_gmm_vis.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9e50ac03dc779c851fa74e8eeff4beda8d1588f Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/flow_gmm_vis.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/models.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/models.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f80faca3a54a277593777b1540a51ed03ba54a2 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/models.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/networks.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/networks.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2d2a000256bbcc0a194ab21912f28570d7bc264 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/networks.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/networks.cpython-37.pyc b/VITON-Extends-Train/models/__pycache__/networks.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e896fc46a2985bc546457f5cb2ce9e78d34bf55 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/networks.cpython-37.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/networks_flow.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/networks_flow.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8eec01bca5ad2ac84b8a71666e45fc769b7b5d2a Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/networks_flow.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/pix2pixHD_model.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/pix2pixHD_model.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ae54fa9b3f8d389d3e6f48a4c9355b974bba12d Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/pix2pixHD_model.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/__pycache__/predict_mask.cpython-36.pyc b/VITON-Extends-Train/models/__pycache__/predict_mask.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..70ffddf0900e9a31ef849717d055a69b26934bb4 Binary files /dev/null and b/VITON-Extends-Train/models/__pycache__/predict_mask.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/correlation/README.md b/VITON-Extends-Train/models/correlation/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a8e0ca529d50b7e09d521cc288daae7771514188 --- /dev/null +++ b/VITON-Extends-Train/models/correlation/README.md @@ -0,0 +1 @@ +This is an adaptation of the FlowNet2 implementation in order to compute cost volumes. Should you be making use of this work, please make sure to adhere to the licensing terms of the original authors. Should you be making use or modify this particular implementation, please acknowledge it appropriately. \ No newline at end of file diff --git a/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-36.pyc b/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d58aede358fff8fe431f866104e5afc545c58464 Binary files /dev/null and b/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-36.pyc differ diff --git a/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-37.pyc b/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e2091355fdabde848b84e356816dcce4ee85ec5 Binary files /dev/null and b/VITON-Extends-Train/models/correlation/__pycache__/correlation.cpython-37.pyc differ diff --git a/VITON-Extends-Train/models/correlation/correlation.py b/VITON-Extends-Train/models/correlation/correlation.py new file mode 100644 index 0000000000000000000000000000000000000000..2268bc427a0119952e44151af383ac6c61b12222 --- /dev/null +++ b/VITON-Extends-Train/models/correlation/correlation.py @@ -0,0 +1,405 @@ +#!/usr/bin/env python + +import torch + +import cupy +import math +import re + +kernel_Correlation_rearrange = ''' + extern "C" __global__ void kernel_Correlation_rearrange( + const int n, + const float* input, + float* output + ) { + int intIndex = (blockIdx.x * blockDim.x) + threadIdx.x; + + if (intIndex >= n) { + return; + } + + int intSample = blockIdx.z; + int intChannel = blockIdx.y; + + float fltValue = input[(((intSample * SIZE_1(input)) + intChannel) * SIZE_2(input) * SIZE_3(input)) + intIndex]; + + __syncthreads(); + + int intPaddedY = (intIndex / SIZE_3(input)) + 3*{{intStride}}; + int intPaddedX = (intIndex % SIZE_3(input)) + 3*{{intStride}}; + int intRearrange = ((SIZE_3(input) + 6*{{intStride}}) * intPaddedY) + intPaddedX; + + output[(((intSample * SIZE_1(output) * SIZE_2(output)) + intRearrange) * SIZE_1(input)) + intChannel] = fltValue; + } +''' + +kernel_Correlation_updateOutput = ''' + extern "C" __global__ void kernel_Correlation_updateOutput( + const int n, + const float* rbot0, + const float* rbot1, + float* top + ) { + extern __shared__ char patch_data_char[]; + + float *patch_data = (float *)patch_data_char; + + // First (upper left) position of kernel upper-left corner in current center position of neighborhood in image 1 + int x1 = (blockIdx.x + 3) * {{intStride}}; + int y1 = (blockIdx.y + 3) * {{intStride}}; + int item = blockIdx.z; + int ch_off = threadIdx.x; + + // Load 3D patch into shared shared memory + for (int j = 0; j < 1; j++) { // HEIGHT + for (int i = 0; i < 1; i++) { // WIDTH + int ji_off = (j + i) * SIZE_3(rbot0); + for (int ch = ch_off; ch < SIZE_3(rbot0); ch += 32) { // CHANNELS + int idx1 = ((item * SIZE_1(rbot0) + y1+j) * SIZE_2(rbot0) + x1+i) * SIZE_3(rbot0) + ch; + int idxPatchData = ji_off + ch; + patch_data[idxPatchData] = rbot0[idx1]; + } + } + } + + __syncthreads(); + + __shared__ float sum[32]; + + // Compute correlation + for (int top_channel = 0; top_channel < SIZE_1(top); top_channel++) { + sum[ch_off] = 0; + + int s2o = (top_channel % 7 - 3) * {{intStride}}; + int s2p = (top_channel / 7 - 3) * {{intStride}}; + + for (int j = 0; j < 1; j++) { // HEIGHT + for (int i = 0; i < 1; i++) { // WIDTH + int ji_off = (j + i) * SIZE_3(rbot0); + for (int ch = ch_off; ch < SIZE_3(rbot0); ch += 32) { // CHANNELS + int x2 = x1 + s2o; + int y2 = y1 + s2p; + + int idxPatchData = ji_off + ch; + int idx2 = ((item * SIZE_1(rbot0) + y2+j) * SIZE_2(rbot0) + x2+i) * SIZE_3(rbot0) + ch; + + sum[ch_off] += patch_data[idxPatchData] * rbot1[idx2]; + } + } + } + + __syncthreads(); + + if (ch_off == 0) { + float total_sum = 0; + for (int idx = 0; idx < 32; idx++) { + total_sum += sum[idx]; + } + const int sumelems = SIZE_3(rbot0); + const int index = ((top_channel*SIZE_2(top) + blockIdx.y)*SIZE_3(top))+blockIdx.x; + top[index + item*SIZE_1(top)*SIZE_2(top)*SIZE_3(top)] = total_sum / (float)sumelems; + } + } + } +''' + +kernel_Correlation_updateGradFirst = ''' + #define ROUND_OFF 50000 + + extern "C" __global__ void kernel_Correlation_updateGradFirst( + const int n, + const int intSample, + const float* rbot0, + const float* rbot1, + const float* gradOutput, + float* gradFirst, + float* gradSecond + ) { for (int intIndex = (blockIdx.x * blockDim.x) + threadIdx.x; intIndex < n; intIndex += blockDim.x * gridDim.x) { + int n = intIndex % SIZE_1(gradFirst); // channels + int l = (intIndex / SIZE_1(gradFirst)) % SIZE_3(gradFirst) + 3*{{intStride}}; // w-pos + int m = (intIndex / SIZE_1(gradFirst) / SIZE_3(gradFirst)) % SIZE_2(gradFirst) + 3*{{intStride}}; // h-pos + + // round_off is a trick to enable integer division with ceil, even for negative numbers + // We use a large offset, for the inner part not to become negative. + const int round_off = ROUND_OFF; + const int round_off_s1 = {{intStride}} * round_off; + + // We add round_off before_s1 the int division and subtract round_off after it, to ensure the formula matches ceil behavior: + int xmin = (l - 3*{{intStride}} + round_off_s1 - 1) / {{intStride}} + 1 - round_off; // ceil (l - 3*{{intStride}}) / {{intStride}} + int ymin = (m - 3*{{intStride}} + round_off_s1 - 1) / {{intStride}} + 1 - round_off; // ceil (l - 3*{{intStride}}) / {{intStride}} + + // Same here: + int xmax = (l - 3*{{intStride}} + round_off_s1) / {{intStride}} - round_off; // floor (l - 3*{{intStride}}) / {{intStride}} + int ymax = (m - 3*{{intStride}} + round_off_s1) / {{intStride}} - round_off; // floor (m - 3*{{intStride}}) / {{intStride}} + + float sum = 0; + if (xmax>=0 && ymax>=0 && (xmin<=SIZE_3(gradOutput)-1) && (ymin<=SIZE_2(gradOutput)-1)) { + xmin = max(0,xmin); + xmax = min(SIZE_3(gradOutput)-1,xmax); + + ymin = max(0,ymin); + ymax = min(SIZE_2(gradOutput)-1,ymax); + + for (int p = -3; p <= 3; p++) { + for (int o = -3; o <= 3; o++) { + // Get rbot1 data: + int s2o = {{intStride}} * o; + int s2p = {{intStride}} * p; + int idxbot1 = ((intSample * SIZE_1(rbot0) + (m+s2p)) * SIZE_2(rbot0) + (l+s2o)) * SIZE_3(rbot0) + n; + float bot1tmp = rbot1[idxbot1]; // rbot1[l+s2o,m+s2p,n] + + // Index offset for gradOutput in following loops: + int op = (p+3) * 7 + (o+3); // index[o,p] + int idxopoffset = (intSample * SIZE_1(gradOutput) + op); + + for (int y = ymin; y <= ymax; y++) { + for (int x = xmin; x <= xmax; x++) { + int idxgradOutput = (idxopoffset * SIZE_2(gradOutput) + y) * SIZE_3(gradOutput) + x; // gradOutput[x,y,o,p] + sum += gradOutput[idxgradOutput] * bot1tmp; + } + } + } + } + } + const int sumelems = SIZE_1(gradFirst); + const int bot0index = ((n * SIZE_2(gradFirst)) + (m-3*{{intStride}})) * SIZE_3(gradFirst) + (l-3*{{intStride}}); + gradFirst[bot0index + intSample*SIZE_1(gradFirst)*SIZE_2(gradFirst)*SIZE_3(gradFirst)] = sum / (float)sumelems; + } } +''' + +kernel_Correlation_updateGradSecond = ''' + #define ROUND_OFF 50000 + + extern "C" __global__ void kernel_Correlation_updateGradSecond( + const int n, + const int intSample, + const float* rbot0, + const float* rbot1, + const float* gradOutput, + float* gradFirst, + float* gradSecond + ) { for (int intIndex = (blockIdx.x * blockDim.x) + threadIdx.x; intIndex < n; intIndex += blockDim.x * gridDim.x) { + int n = intIndex % SIZE_1(gradSecond); // channels + int l = (intIndex / SIZE_1(gradSecond)) % SIZE_3(gradSecond) + 3*{{intStride}}; // w-pos + int m = (intIndex / SIZE_1(gradSecond) / SIZE_3(gradSecond)) % SIZE_2(gradSecond) + 3*{{intStride}}; // h-pos + + // round_off is a trick to enable integer division with ceil, even for negative numbers + // We use a large offset, for the inner part not to become negative. + const int round_off = ROUND_OFF; + const int round_off_s1 = {{intStride}} * round_off; + + float sum = 0; + for (int p = -3; p <= 3; p++) { + for (int o = -3; o <= 3; o++) { + int s2o = {{intStride}} * o; + int s2p = {{intStride}} * p; + + //Get X,Y ranges and clamp + // We add round_off before_s1 the int division and subtract round_off after it, to ensure the formula matches ceil behavior: + int xmin = (l - 3*{{intStride}} - s2o + round_off_s1 - 1) / {{intStride}} + 1 - round_off; // ceil (l - 3*{{intStride}} - s2o) / {{intStride}} + int ymin = (m - 3*{{intStride}} - s2p + round_off_s1 - 1) / {{intStride}} + 1 - round_off; // ceil (l - 3*{{intStride}} - s2o) / {{intStride}} + + // Same here: + int xmax = (l - 3*{{intStride}} - s2o + round_off_s1) / {{intStride}} - round_off; // floor (l - 3*{{intStride}} - s2o) / {{intStride}} + int ymax = (m - 3*{{intStride}} - s2p + round_off_s1) / {{intStride}} - round_off; // floor (m - 3*{{intStride}} - s2p) / {{intStride}} + + if (xmax>=0 && ymax>=0 && (xmin<=SIZE_3(gradOutput)-1) && (ymin<=SIZE_2(gradOutput)-1)) { + xmin = max(0,xmin); + xmax = min(SIZE_3(gradOutput)-1,xmax); + + ymin = max(0,ymin); + ymax = min(SIZE_2(gradOutput)-1,ymax); + + // Get rbot0 data: + int idxbot0 = ((intSample * SIZE_1(rbot0) + (m-s2p)) * SIZE_2(rbot0) + (l-s2o)) * SIZE_3(rbot0) + n; + float bot0tmp = rbot0[idxbot0]; // rbot1[l+s2o,m+s2p,n] + + // Index offset for gradOutput in following loops: + int op = (p+3) * 7 + (o+3); // index[o,p] + int idxopoffset = (intSample * SIZE_1(gradOutput) + op); + + for (int y = ymin; y <= ymax; y++) { + for (int x = xmin; x <= xmax; x++) { + int idxgradOutput = (idxopoffset * SIZE_2(gradOutput) + y) * SIZE_3(gradOutput) + x; // gradOutput[x,y,o,p] + sum += gradOutput[idxgradOutput] * bot0tmp; + } + } + } + } + } + const int sumelems = SIZE_1(gradSecond); + const int bot1index = ((n * SIZE_2(gradSecond)) + (m-3*{{intStride}})) * SIZE_3(gradSecond) + (l-3*{{intStride}}); + gradSecond[bot1index + intSample*SIZE_1(gradSecond)*SIZE_2(gradSecond)*SIZE_3(gradSecond)] = sum / (float)sumelems; + } } +''' + +def cupy_kernel(strFunction, objVariables): + strKernel = globals()[strFunction].replace('{{intStride}}', str(objVariables['intStride'])) + + while True: + objMatch = re.search('(SIZE_)([0-4])(\()([^\)]*)(\))', strKernel) + + if objMatch is None: + break + # end + + intArg = int(objMatch.group(2)) + + strTensor = objMatch.group(4) + intSizes = objVariables[strTensor].size() + + strKernel = strKernel.replace(objMatch.group(), str(intSizes[intArg])) + # end + + while True: + objMatch = re.search('(VALUE_)([0-4])(\()([^\)]+)(\))', strKernel) + + if objMatch is None: + break + # end + + intArgs = int(objMatch.group(2)) + strArgs = objMatch.group(4).split(',') + + strTensor = strArgs[0] + intStrides = objVariables[strTensor].stride() + strIndex = [ '((' + strArgs[intArg + 1].replace('{', '(').replace('}', ')').strip() + ')*' + str(intStrides[intArg]) + ')' for intArg in range(intArgs) ] + + strKernel = strKernel.replace(objMatch.group(0), strTensor + '[' + str.join('+', strIndex) + ']') + # end + + return strKernel +# end + +@cupy.util.memoize(for_each_device=True) +def cupy_launch(strFunction, strKernel): + return cupy.cuda.compile_with_cache(strKernel).get_function(strFunction) +# end + +class _FunctionCorrelation(torch.autograd.Function): + @staticmethod + def forward(self, first, second, intStride): + rbot0 = first.new_zeros([ first.shape[0], first.shape[2] + (6 * intStride), first.shape[3] + (6 * intStride), first.shape[1] ]) + rbot1 = first.new_zeros([ first.shape[0], first.shape[2] + (6 * intStride), first.shape[3] + (6 * intStride), first.shape[1] ]) + + self.save_for_backward(first, second, rbot0, rbot1) + + self.intStride = intStride + + assert(first.is_contiguous() == True) + assert(second.is_contiguous() == True) + + output = first.new_zeros([ first.shape[0], 49, int(math.ceil(first.shape[2] / intStride)), int(math.ceil(first.shape[3] / intStride)) ]) + + if first.is_cuda == True: + n = first.shape[2] * first.shape[3] + cupy_launch('kernel_Correlation_rearrange', cupy_kernel('kernel_Correlation_rearrange', { + 'intStride': self.intStride, + 'input': first, + 'output': rbot0 + }))( + grid=tuple([ int((n + 16 - 1) / 16), first.shape[1], first.shape[0] ]), + block=tuple([ 16, 1, 1 ]), + args=[ n, first.data_ptr(), rbot0.data_ptr() ] + ) + + n = second.shape[2] * second.shape[3] + cupy_launch('kernel_Correlation_rearrange', cupy_kernel('kernel_Correlation_rearrange', { + 'intStride': self.intStride, + 'input': second, + 'output': rbot1 + }))( + grid=tuple([ int((n + 16 - 1) / 16), second.shape[1], second.shape[0] ]), + block=tuple([ 16, 1, 1 ]), + args=[ n, second.data_ptr(), rbot1.data_ptr() ] + ) + + n = output.shape[1] * output.shape[2] * output.shape[3] + cupy_launch('kernel_Correlation_updateOutput', cupy_kernel('kernel_Correlation_updateOutput', { + 'intStride': self.intStride, + 'rbot0': rbot0, + 'rbot1': rbot1, + 'top': output + }))( + grid=tuple([ output.shape[3], output.shape[2], output.shape[0] ]), + block=tuple([ 32, 1, 1 ]), + shared_mem=first.shape[1] * 4, + args=[ n, rbot0.data_ptr(), rbot1.data_ptr(), output.data_ptr() ] + ) + + elif first.is_cuda == False: + raise NotImplementedError() + + # end + + return output + # end + + @staticmethod + def backward(self, gradOutput): + first, second, rbot0, rbot1 = self.saved_tensors + + assert(gradOutput.is_contiguous() == True) + + gradFirst = first.new_zeros([ first.shape[0], first.shape[1], first.shape[2], first.shape[3] ]) if self.needs_input_grad[0] == True else None + gradSecond = first.new_zeros([ first.shape[0], first.shape[1], first.shape[2], first.shape[3] ]) if self.needs_input_grad[1] == True else None + + if first.is_cuda == True: + if gradFirst is not None: + for intSample in range(first.shape[0]): + n = first.shape[1] * first.shape[2] * first.shape[3] + cupy_launch('kernel_Correlation_updateGradFirst', cupy_kernel('kernel_Correlation_updateGradFirst', { + 'intStride': self.intStride, + 'rbot0': rbot0, + 'rbot1': rbot1, + 'gradOutput': gradOutput, + 'gradFirst': gradFirst, + 'gradSecond': None + }))( + grid=tuple([ int((n + 512 - 1) / 512), 1, 1 ]), + block=tuple([ 512, 1, 1 ]), + args=[ n, intSample, rbot0.data_ptr(), rbot1.data_ptr(), gradOutput.data_ptr(), gradFirst.data_ptr(), None ] + ) + # end + # end + + if gradSecond is not None: + for intSample in range(first.shape[0]): + n = first.shape[1] * first.shape[2] * first.shape[3] + cupy_launch('kernel_Correlation_updateGradSecond', cupy_kernel('kernel_Correlation_updateGradSecond', { + 'intStride': self.intStride, + 'rbot0': rbot0, + 'rbot1': rbot1, + 'gradOutput': gradOutput, + 'gradFirst': None, + 'gradSecond': gradSecond + }))( + grid=tuple([ int((n + 512 - 1) / 512), 1, 1 ]), + block=tuple([ 512, 1, 1 ]), + args=[ n, intSample, rbot0.data_ptr(), rbot1.data_ptr(), gradOutput.data_ptr(), None, gradSecond.data_ptr() ] + ) + # end + # end + + elif first.is_cuda == False: + raise NotImplementedError() + + # end + + return gradFirst, gradSecond, None + # end +# end + +def FunctionCorrelation(tenFirst, tenSecond, intStride): + return _FunctionCorrelation.apply(tenFirst, tenSecond, intStride) +# end + +class ModuleCorrelation(torch.nn.Module): + def __init__(self): + super(ModuleCorrelation, self).__init__() + # end + + def forward(self, tenFirst, tenSecond, intStride): + return _FunctionCorrelation.apply(tenFirst, tenSecond, intStride) + # end +# end \ No newline at end of file diff --git a/VITON-Extends-Train/options/__pycache__/__init__.cpython-36.pyc b/VITON-Extends-Train/options/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..542f32a9faa6d1ea52543787cc5db88758debe2f Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/__init__.cpython-36.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/__init__.cpython-37.pyc b/VITON-Extends-Train/options/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dba454f30ae4da91a2233f30fe94113af7b47bdf Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/__init__.cpython-37.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/base_options.cpython-36.pyc b/VITON-Extends-Train/options/__pycache__/base_options.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..413777935aaa9ca326573fe8cd041719b404c009 Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/base_options.cpython-36.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/base_options.cpython-37.pyc b/VITON-Extends-Train/options/__pycache__/base_options.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88afa1737c19e58b23ed879b5178db61ffeb68fe Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/base_options.cpython-37.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/test_options.cpython-36.pyc b/VITON-Extends-Train/options/__pycache__/test_options.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f048aec72270b9c72b07e5ce76b73498efaaeaf Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/test_options.cpython-36.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/train_options.cpython-36.pyc b/VITON-Extends-Train/options/__pycache__/train_options.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..68baf84005e3919467a0dd1695a663bfda2617ac Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/train_options.cpython-36.pyc differ diff --git a/VITON-Extends-Train/options/__pycache__/train_options.cpython-37.pyc b/VITON-Extends-Train/options/__pycache__/train_options.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e775ce5c79b5b1472c2322eb42b0886b6e62c5e9 Binary files /dev/null and b/VITON-Extends-Train/options/__pycache__/train_options.cpython-37.pyc differ diff --git a/VITON-Extends-Train/util/__pycache__/__init__.cpython-36.pyc b/VITON-Extends-Train/util/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2158e2ca05b9375d40c268e41eb095b65f8f453 Binary files /dev/null and b/VITON-Extends-Train/util/__pycache__/__init__.cpython-36.pyc differ diff --git a/VITON-Extends-Train/util/__pycache__/__init__.cpython-37.pyc b/VITON-Extends-Train/util/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9363ffbb56f3c2dc1b0b7014dc02f3f9978d5fb8 Binary files /dev/null and b/VITON-Extends-Train/util/__pycache__/__init__.cpython-37.pyc differ diff --git a/VITON-Extends-Train/util/__pycache__/image_pool.cpython-36.pyc b/VITON-Extends-Train/util/__pycache__/image_pool.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b81fdeb186a11e340d2823c8a1817bc234e01d8 Binary files /dev/null and b/VITON-Extends-Train/util/__pycache__/image_pool.cpython-36.pyc differ diff --git a/VITON-Extends-Train/util/__pycache__/util.cpython-36.pyc b/VITON-Extends-Train/util/__pycache__/util.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6396a7b877d36a4cc87887d8a4cc8c711fb959a3 Binary files /dev/null and b/VITON-Extends-Train/util/__pycache__/util.cpython-36.pyc differ diff --git a/VITON-Extends-Train/util/__pycache__/util.cpython-37.pyc b/VITON-Extends-Train/util/__pycache__/util.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..818ba45379f9e52947fe1ecddf0970693482d7c6 Binary files /dev/null and b/VITON-Extends-Train/util/__pycache__/util.cpython-37.pyc differ diff --git a/VITON-Extends_test/app/globals.css b/VITON-Extends_test/app/globals.css new file mode 100644 index 0000000000000000000000000000000000000000..20c923782c4d477e06ccb543b687ec65288183f1 --- /dev/null +++ b/VITON-Extends_test/app/globals.css @@ -0,0 +1,108 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + + --primary: 271 81% 56%; + --primary-foreground: 210 40% 98%; + + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 271 81% 56%; + + --radius: 0.5rem; + } + + .dark { + --background: 0 0% 0%; + --foreground: 210 40% 98%; + + --card: 0 0% 5%; + --card-foreground: 210 40% 98%; + + --popover: 0 0% 0%; + --popover-foreground: 210 40% 98%; + + --primary: 271 81% 56%; + --primary-foreground: 222.2 47.4% 11.2%; + + --secondary: 0 0% 10%; + --secondary-foreground: 210 40% 98%; + + --muted: 0 0% 10%; + --muted-foreground: 215 20.2% 65.1%; + + --accent: 0 0% 15%; + --accent-foreground: 210 40% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + + --border: 0 0% 15%; + --input: 0 0% 15%; + --ring: 271 81% 56%; + } +} + +@layer base { + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} + +@keyframes sparkle { + 0%, + 100% { + opacity: 0; + transform: scale(0); + } + 50% { + opacity: 1; + transform: scale(1); + } +} + +@keyframes float { + 0%, + 100% { + transform: translateY(0) rotate(0deg); + } + 50% { + transform: translateY(-20px) rotate(10deg); + } +} + +@keyframes pulse { + 0%, + 100% { + opacity: 0.5; + } + 50% { + opacity: 1; + } +} diff --git a/VITON-Extends_test/app/layout.tsx b/VITON-Extends_test/app/layout.tsx new file mode 100644 index 0000000000000000000000000000000000000000..65b0e642ad6885e124252ae263d794012f0cbf4a --- /dev/null +++ b/VITON-Extends_test/app/layout.tsx @@ -0,0 +1,28 @@ +import type React from "react" +import "./globals.css" +import { Inter } from "next/font/google" +import { ThemeProvider } from "@/components/theme-provider" + +const inter = Inter({ subsets: ["latin"] }) + +export const metadata = { + title: "MiRRA - Style in Sight", + description: "Virtual try-on and smart stylist for fashion lovers", + generator: 'v0.dev' +} + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + + {children} + + + + ) +} diff --git a/VITON-Extends_test/app/page.tsx b/VITON-Extends_test/app/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c5892d36b997e3801d8b259ab399cbf8a2791cac --- /dev/null +++ b/VITON-Extends_test/app/page.tsx @@ -0,0 +1,908 @@ +"use client" + +import { useState, useRef, useEffect } from "react" +import Image from "next/image" +import { motion, useScroll, useTransform } from "framer-motion" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Textarea } from "@/components/ui/textarea" +import { Card } from "@/components/ui/card" +import { Camera, Upload, MessageSquare, ChevronRight, ChevronLeft, Send, ArrowRight } from "lucide-react" + +// Sparkle component +const Sparkle = ({ size = "sm", color = "white", delay = 0, duration = 2, className = "" }) => { + const sizeMap = { + xs: "w-1 h-1", + sm: "w-1.5 h-1.5", + md: "w-2 h-2", + lg: "w-3 h-3", + } + + const colorMap = { + white: "bg-white", + purple: "bg-purple-400", + pink: "bg-pink-400", + blue: "bg-blue-400", + } + + return ( + + ) +} + +// Animation variants +const fadeIn = { + hidden: { opacity: 0, y: 40 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, +} + +const fadeInLeft = { + hidden: { opacity: 0, x: -60 }, + visible: { + opacity: 1, + x: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, +} + +const fadeInRight = { + hidden: { opacity: 0, x: 60 }, + visible: { + opacity: 1, + x: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, +} + +const staggerContainer = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.3, + }, + }, +} + +export default function Home() { + const [activeSlide, setActiveSlide] = useState(0) + const [messages, setMessages] = useState([ + { text: "Hi there! I'm your smart stylist. What's your style preference today?", sender: "bot" }, + ]) + const [messageInput, setMessageInput] = useState("") + + const featuresRef = useRef(null) + const tryOnRef = useRef(null) + const stylistRef = useRef(null) + const shopRef = useRef(null) + const contactRef = useRef(null) + const carouselRef = useRef(null) + + const { scrollYProgress: featuresScrollProgress } = useScroll({ + target: featuresRef, + offset: ["start end", "end start"], + }) + + const { scrollYProgress: tryOnScrollProgress } = useScroll({ + target: tryOnRef, + offset: ["start end", "end start"], + }) + + const { scrollYProgress: stylistScrollProgress } = useScroll({ + target: stylistRef, + offset: ["start end", "end start"], + }) + + const { scrollYProgress: shopScrollProgress } = useScroll({ + target: shopRef, + offset: ["start end", "end start"], + }) + + const { scrollYProgress: contactScrollProgress } = useScroll({ + target: contactRef, + offset: ["start end", "end start"], + }) + + const featuresOpacity = useTransform(featuresScrollProgress, [0, 0.3, 0.7, 1], [0, 1, 1, 0]) + const featuresY = useTransform(featuresScrollProgress, [0, 0.3, 0.7, 1], [100, 0, 0, 100]) + + const tryOnOpacity = useTransform(tryOnScrollProgress, [0, 0.3, 0.7, 1], [0, 1, 1, 0]) + const tryOnY = useTransform(tryOnScrollProgress, [0, 0.3, 0.7, 1], [100, 0, 0, 100]) + + const stylistOpacity = useTransform(stylistScrollProgress, [0, 0.3, 0.7, 1], [0, 1, 1, 0]) + const stylistY = useTransform(stylistScrollProgress, [0, 0.3, 0.7, 1], [100, 0, 0, 100]) + + const shopOpacity = useTransform(shopScrollProgress, [0, 0.3, 0.7, 1], [0, 1, 1, 0]) + const shopY = useTransform(shopScrollProgress, [0, 0.3, 0.7, 1], [100, 0, 0, 100]) + + const contactOpacity = useTransform(contactScrollProgress, [0, 0.3, 0.7, 1], [0, 1, 1, 0]) + const contactY = useTransform(contactScrollProgress, [0, 0.3, 0.7, 1], [100, 0, 0, 100]) + + const products = [ + { id: 1, name: "Summer Dress", price: "$49.99", image: "/placeholder.svg?height=300&width=300" }, + { id: 2, name: "Casual Jeans", price: "$39.99", image: "/placeholder.svg?height=300&width=300" }, + { id: 3, name: "Elegant Blouse", price: "$29.99", image: "/placeholder.svg?height=300&width=300" }, + { id: 4, name: "Formal Suit", price: "$99.99", image: "/placeholder.svg?height=300&width=300" }, + { id: 5, name: "Winter Coat", price: "$79.99", image: "/placeholder.svg?height=300&width=300" }, + ] + + const recommendedItems = [ + { id: 1, name: "Striped T-Shirt", price: "$24.99", image: "/placeholder.svg?height=150&width=150" }, + { id: 2, name: "Denim Jacket", price: "$59.99", image: "/placeholder.svg?height=150&width=150" }, + { id: 3, name: "Black Pants", price: "$34.99", image: "/placeholder.svg?height=150&width=150" }, + ] + + // Auto-scroll carousel + useEffect(() => { + const interval = setInterval(() => { + setActiveSlide((prev) => (prev === products.length - 1 ? 0 : prev + 1)) + }, 3000) + + return () => clearInterval(interval) + }, [products.length]) + + const nextSlide = () => { + setActiveSlide((prev) => (prev === products.length - 1 ? 0 : prev + 1)) + } + + const prevSlide = () => { + setActiveSlide((prev) => (prev === 0 ? products.length - 1 : prev - 1)) + } + + const sendMessage = () => { + if (messageInput.trim()) { + setMessages([...messages, { text: messageInput, sender: "user" }]) + + // Simulate bot response + setTimeout(() => { + setMessages((prev) => [ + ...prev, + { + text: "Based on your style, I recommend checking out our new collection of casual wear. Here are some items that might interest you.", + sender: "bot", + }, + ]) + }, 1000) + + setMessageInput("") + } + } + + const scrollToSection = (ref) => { + ref.current.scrollIntoView({ behavior: "smooth" }) + } + + return ( +
+ {/* Hero Section */} +
+
+ + {/* Sparkle effects */} +
+ {/* Large sparkles */} + {[...Array(20)].map((_, i) => ( + 0.7 ? "lg" : Math.random() > 0.5 ? "md" : "sm"} + color={Math.random() > 0.7 ? "white" : Math.random() > 0.5 ? "purple" : "pink"} + delay={Math.random() * 5} + duration={Math.random() * 2 + 1.5} + /> + ))} + + {/* Floating light particles */} + {[...Array(30)].map((_, i) => ( + + ))} + + {/* Glowing orbs */} + {[...Array(5)].map((_, i) => ( + + ))} +
+ + + + + MiRRA + + + {/* Logo sparkles */} + {[...Array(8)].map((_, i) => ( + + ))} + + + style in sight + + + + + + +
+ + + +
+
+ + {/* Overview Section */} +
+ + + Welcome to MiRRA + + +
+ +
+ MiRRA Overview +
+ + +

Redefining Fashion Experience

+

+ MiRRA combines cutting-edge technology with fashion expertise to create a personalized shopping + experience. Our platform offers virtual try-on capabilities and AI-powered styling recommendations to + help you discover your perfect look without leaving your home. +

+
+
+
+ +
+
+

Virtual Try-On

+

See how clothes look on you before buying

+
+
+ +
+
+ +
+
+

Smart Stylist

+

AI-powered fashion advice tailored to you

+
+
+
+ + +
+
+
+
+ + {/* Virtual Try-On Section */} +
+ + + Virtual Try-On + + +
+ +

Upload Your Photo

+

+ See how our clothes look on you by uploading your photo or using your camera. Our AI will fit the + garments to your body shape and size. +

+ +
+ + + + +
+ Drag and drop your photo here or use the buttons above +
+
+
+ + +

Try-On Results

+
+ Virtual Try-On Result +
+
+ {[1, 2, 3, 4].map((item) => ( +
+ {`Outfit +
+ ))} +
+
+
+
+
+ + {/* Smart Stylist Section */} +
+ + + Smart Stylist + + +
+ +

Chat with Your Personal Stylist

+ +
+ {messages.map((message, index) => ( +
+
+ {message.text} +
+
+ ))} +
+ +
+ setMessageInput(e.target.value)} + onKeyPress={(e) => e.key === "Enter" && sendMessage()} + className="flex-grow bg-gray-800 border-purple-700 text-white" + /> + +
+
+ + +

Recommended for You

+
+ {recommendedItems.map((item) => ( + +
+
+ {item.name} +
+
+

{item.name}

+

{item.price}

+ +
+
+ ))} +
+
+
+
+
+ + {/* Shop Section */} +
+ + + Our Shop + + + +
+
+ {products.map((product) => ( +
+
+
+
+ {product.name} +
+

{product.name}

+

+ {product.price} +

+ +
+
+ ))} +
+
+ + + + + +
+ {products.map((_, index) => ( +
+
+ + + + +
+
+ + {/* Contact Section */} +
+ + + Contact Us + + +
+ +

Get in Touch

+

+ Have questions about our products or services? We'd love to hear from you. Fill out the form and our + team will get back to you as soon as possible. +

+ +
+
+
+ + + +
+ contact@mirra.com +
+ +
+
+ + + +
+ +1 (555) 123-4567 +
+ +
+
+ + + + +
+ 123 Fashion Street, New York, NY 10001 +
+
+
+ + +
+
+
+ + +
+ +
+ + +
+
+ +
+ + +
+ +
+ +