Skip to content

Commit

Permalink
Notebook to process samples
Browse files Browse the repository at this point in the history
  • Loading branch information
0oTinaKimo0 committed Nov 14, 2022
1 parent 7f2d8c1 commit 7eab29d
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ src/objs
build
.DS_Store
*.exr
.ipynb_checkpoints
92 changes: 92 additions & 0 deletions tools/rpf.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import struct\n",
"import cv2 as cv\n",
"from sklearn.feature_selection import mutual_info_regression\n",
"from sklearn.preprocessing import scale"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"100 100 8 28\n"
]
}
],
"source": [
"with open('../scenes/sample.dat', 'rb') as f:\n",
" fileContent = f.read()\n",
" width, height, spp, SL = struct.unpack(\"QQQQ\", fileContent[:32])\n",
" m = struct.unpack(\"f\" * ((len(fileContent) - 32) // 4), fileContent[32:])\n",
"print(width, height, spp, SL)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"def preprocess(x, y, b, M):\n",
" N = np.random.normal(scale=b/4, size=(M - spp, 1))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"boxSizes = [55, 35, 17, 7]\n",
"for t in range(4):\n",
" b = boxSizes[t]\n",
" maxNumOfSamples = (b * b * spp) // 2\n",
" for i in range(height):\n",
" for j in range(width):\n",
" N = preprocess(i, j, b, maxNumOfSamples)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit 7eab29d

Please sign in to comment.