Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Image Compression
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nathaniel Callens
Image Compression
Commits
482eeae2
Commit
482eeae2
authored
Feb 15, 2022
by
Nathaniel Callens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
research in wavelets
parent
48804c56
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
prediction_MSE_Scout-checkpoint.ipynb
.ipynb_checkpoints/prediction_MSE_Scout-checkpoint.ipynb
+27
-11
No files found.
.ipynb_checkpoints/prediction_MSE_Scout-checkpoint.ipynb
View file @
482eeae2
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
62
,
"execution_count":
99
,
"id": "470cc137",
"id": "470cc137",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
...
@@ -276,15 +276,27 @@
...
@@ -276,15 +276,27 @@
"name": "stdout",
"name": "stdout",
"output_type": "stream",
"output_type": "stream",
"text": [
"text": [
"
5.667000202436157e-12
\n"
"
(258, 322)
\n"
]
]
},
{
"data": {
"text/plain": [
"'print(decompress)\\nprint(np.mean(np.abs(decompress-no_ravel)))'"
]
},
"execution_count": 99,
"metadata": {},
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"coeffs = pywt.dwt2(no_ravel, 'bior1.3')\n",
"coeffs = pywt.dwt2(no_ravel, 'bior1.3')\n",
"LL, (LH, HL, HH) = coeffs\n",
"LL, (LH, HL, HH) = coeffs\n",
"print(HH.shape)\n",
"decompress = pywt.idwt2(coeffs, 'bior1.3')\n",
"decompress = pywt.idwt2(coeffs, 'bior1.3')\n",
"print(np.mean(np.abs(decompress-no_ravel)))\n"
"\"\"\"print(decompress)\n",
"print(np.mean(np.abs(decompress-no_ravel)))\"\"\"\n"
]
]
},
},
{
{
...
@@ -338,15 +350,21 @@
...
@@ -338,15 +350,21 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
88
,
"execution_count":
101
,
"id": "f9687830",
"id": "f9687830",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"name": "stdout",
"ename": "ValueError",
"output_type": "stream",
"evalue": "too many values to unpack (expected 2)",
"text": [
"output_type": "error",
"0.01910218596458435\n"
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_22104/2202774112.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[0mtimes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstop\u001b[0m\u001b[1;33m-\u001b[0m\u001b[0mstart\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mtimes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 20\u001b[1;33m \u001b[0mti\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwave_decompress\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcoef\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 21\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mti\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_22104/2202774112.py\u001b[0m in \u001b[0;36mwave_decompress\u001b[1;34m(coeffs)\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcoeffs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[0mstart\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 16\u001b[1;33m \u001b[0mdecompress\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpywt\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0midwt2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcoeffs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'bior1.3'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 17\u001b[0m \u001b[0mstop\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[0mtimes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstop\u001b[0m\u001b[1;33m-\u001b[0m\u001b[0mstart\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pywt\\_multidim.py\u001b[0m in \u001b[0;36midwt2\u001b[1;34m(coeffs, wavelet, mode, axes)\u001b[0m\n\u001b[0;32m 110\u001b[0m \"\"\"\n\u001b[0;32m 111\u001b[0m \u001b[1;31m# L -low-pass data, H - high-pass data\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 112\u001b[1;33m \u001b[0mLL\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mHL\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mLH\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mHH\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcoeffs\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 113\u001b[0m \u001b[0maxes\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtuple\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maxes\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 114\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maxes\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[1;36m2\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mValueError\u001b[0m: too many values to unpack (expected 2)"
]
]
}
}
],
],
...
@@ -358,11 +376,9 @@
...
@@ -358,11 +376,9 @@
" coeffs = pywt.dwt2(image, 'bior1.3')\n",
" coeffs = pywt.dwt2(image, 'bior1.3')\n",
" return coeffs\n",
" return coeffs\n",
"\n",
"\n",
"def huffman(coeffs):\n",
" for i in range(len(coeffs)):\n",
" \n",
" \n",
"\n",
"\n",
"coef, t = wavelet(num_images)\n",
"coef, t = wavelet(num_images
,0
)\n",
"\n",
"\n",
"def wave_decompress(coeffs):\n",
"def wave_decompress(coeffs):\n",
" times = []\n",
" times = []\n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment