Row 2255
Content Data
This page contains data entry 2255 from the Axioma AXP content repository. The structured data below represents the complete record for this entry.
Crosspost from my stackoverflow. I would put it on the tfjs sub but it is tiny.
I am sure the solution is out there somewhere, but I have been unable to find it. I originally trained the model in normal tensorflow, but it is being used in tensorflowjs after being converted. My current error is
>Uncaught (in promise) Error: Size(30000) must match the product of shape 100,100,3
Though I have had many others through my attempts.
My code right now is
function preprocess(imageData) { //const img_arr = cv.imread(imageData); let inputTensor = tf.browser.fromPixels(imageData); const offset = tf.scalar(255.0); const normalized = tf.scalar(1.0).sub(inputTensor.div(offset)); const batchInputShape = [100, 100, 3]; const flattenedInput = tf.reshape(normalized, [batchInputShape]); console.log(flattenedInput.shape); return flattenedInput;
The result of this function is then fed into my model, which produces the error. I am sure the solution is obvious but I have been unable to find it.
I have also tried
const batchInputShape = [null, 100, 100, 3]; const flattenedInput = tf.reshape(normalized, [batchInputShape, -1]);
Though that did not fair any better.
| Field | Value |
|---|---|
| text | Crosspost from my stackoverflow. I would put it on the tfjs sub but it is tiny. I am sure the solution is out there somewhere, but I have been unable to find it. I originally trained the model in normal tensorflow, but it is being used in tensorflowjs after being converted. My current error is >Uncaught (in promise) Error: Size(30000) must match the product of shape 100,100,3 Though I have had many others through my attempts. My code right now is function preprocess(imageData) { … |
| label | r/tensorflow |
| dataType | post |
| communityName | r/tensorflow |
| datetime | 2023-07-27 |
| username_encoded | Z0FBQUFBQm5LakwweFNkcEdBZHFlbWZ3NmQtYmc2VUk2NXBrc2Yxdk1aSjU4M09mZDQ2dmtaeUhsdzVVM1lUSVdyRFNhVVFNa283aXhXaG9hOUNuVXVmQk1lWFo1Vy15TGc9PQ== |
| url_encoded | Z0FBQUFBQm5Lak9FOHJaSVdwUUNjeE4wRnJ1dG9kbTI0QjQ1SllabHlCUlVjSVhHU01FSzlaZ0kyM1I3c2RFU29rVGRFUDk2aXBoZEozTEFYaHZYX1E5ZVNnVlBXZy1WUXRRaXRSZnlVMWdKWWFTLVFXbFlNMnU0cGQ2V0VtUFNTY1ZlUG1HMnpWaU5uNU5CbS1oSnJfcEZ0Q251N0NydDUybjVVMi1WbVN3WWVnZFB1WGFMR21WWHg4MnJLeHplVVBHbjViRTNqSWpHNmprZnlYekVIZmp1MHVlTWZvX0hxZz09 |
Raw Record
{
"text": " Crosspost from my stackoverflow. I would put it on the tfjs sub but it is tiny.\n\nI am sure the solution is out there somewhere, but I have been unable to find it. I originally trained the model in normal tensorflow, but it is being used in tensorflowjs after being converted. My current error is\n\n>Uncaught (in promise) Error: Size(30000) must match the product of shape 100,100,3 \n \n\nThough I have had many others through my attempts.\n\nMy code right now is\n\n function preprocess(imageData) { //const img_arr = cv.imread(imageData); let inputTensor = tf.browser.fromPixels(imageData); const offset = tf.scalar(255.0); const normalized = tf.scalar(1.0).sub(inputTensor.div(offset)); const batchInputShape = [100, 100, 3]; const flattenedInput = tf.reshape(normalized, [batchInputShape]); console.log(flattenedInput.shape); return flattenedInput; \n\nThe result of this function is then fed into my model, which produces the error. I am sure the solution is obvious but I have been unable to find it.\n\nI have also tried\n\n const batchInputShape = [null, 100, 100, 3]; const flattenedInput = tf.reshape(normalized, [batchInputShape, -1]); \n\nThough that did not fair any better.",
"label": "r/tensorflow",
"dataType": "post",
"communityName": "r/tensorflow",
"datetime": "2023-07-27",
"username_encoded": "Z0FBQUFBQm5LakwweFNkcEdBZHFlbWZ3NmQtYmc2VUk2NXBrc2Yxdk1aSjU4M09mZDQ2dmtaeUhsdzVVM1lUSVdyRFNhVVFNa283aXhXaG9hOUNuVXVmQk1lWFo1Vy15TGc9PQ==",
"url_encoded": "Z0FBQUFBQm5Lak9FOHJaSVdwUUNjeE4wRnJ1dG9kbTI0QjQ1SllabHlCUlVjSVhHU01FSzlaZ0kyM1I3c2RFU29rVGRFUDk2aXBoZEozTEFYaHZYX1E5ZVNnVlBXZy1WUXRRaXRSZnlVMWdKWWFTLVFXbFlNMnU0cGQ2V0VtUFNTY1ZlUG1HMnpWaU5uNU5CbS1oSnJfcEZ0Q251N0NydDUybjVVMi1WbVN3WWVnZFB1WGFMR21WWHg4MnJLeHplVVBHbjViRTNqSWpHNmprZnlYekVIZmp1MHVlTWZvX0hxZz09"
}
Entry Information
- Entry ID: 2255
- Repository: Axioma AXP
- Dataset: arrmlet/reddit_dataset_36
- Total Entries: 100,000