Upload oraclechunk79.json
Browse files- oraclechunk79.json +10 -0
oraclechunk79.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"QuestionId": 58975671, "AnswerCount": 0, "Tags": "<python><odoo>", "CreationDate": "2019-11-21T13:00:38.097", "AcceptedAnswerId": null, "Title": "problem with TransientModel and abstractmodel", "Body": "<p>I am trying to create a new view for the report of a general ledger, for this by investigating I realized that I have to use the transientmodel and abstractmodel so that it can work. Then I started structuring these wizard models and created the abstractmodel in the report but when executing I get the following error:</p>\n\n<p>File \"/mnt/c/odoo/odoo/models.py\", line 4727, in ensure_one</p>\n\n<pre><code>raise ValueError(\"Expected singleton: %s\" % self)\n</code></pre>\n\n<p><strong>ValueError: Expected singleton: proyecto_rc.account(1, 2)</strong></p>\n\n<p>It is because of the above that I come to this place to see if they can help me to find and resilient the problem. Next I add the code hoping that they understand it.</p>\n\n<p><strong>wizar py</strong></p>\n\n<pre class=\"lang-py prettyprint-override\"><code>\nclass Book (models.TransientModel):\n\n _name = 'project_rc.book'\n\n start_date = fields.Date (string = \"Start date\", required = True)\n\n end_date = fields.Date (string = \"End date\", required = True)\n\n @api.multi\n\n def action_report (self):\n\n \"\" \"Method that calls the logic that generates the report\" \"\"\n\n data = {'ids': self.env.context.get ('active_ids', [])}\n\n res = self.read (['start_date', 'end_date'])\n\n res = res and res [0] or {}\n\n datas ['form'] = res\n\n domain = []\n\n if self.date_date:\n\n domain = [('create_date', '<', self.state_date)]\n\n fields = ['title', 'total_debit_count', 'total_credit_count']\n\n lmayor_data = self.env ['project_rc.account']. search_read (domain, fields)\n\n datas ['lmayor_data'] = lmayor_data\n\n return self.env ['report']. get_action ([], 'project_rc.report_bookmajor', data = data)\n</code></pre>\n\n<p><strong>reports py</strong></p>\n\n<pre class=\"lang-py prettyprint-override\"><code>class report_bookmajor(models.AbstractModel):\n\n _name = 'report.proyecto_rc.bookmajor'\n\n @api.model\n\n def render_html(self, docids, data=None):\n\n data = data if data is not None else {}\n\n bookmajor = self.env['proyecto_rc.account'].browse(data.get('ids', data.get('active_ids')))\n\n docargs = {\n\n 'doc_ids': data.get('ids', data.get('active_ids')),\n\n 'doc_model': 'proyecto_rc.account',\n\n 'docs': bookmajor,\n\n 'data': dict(\n\n data\n\n ),\n\n }\n\n return self.env['report'].render('proyecto_rc.bookmajor_template', docargs)\n</code></pre>\n\n<p>Reviewing these two models, what problem can I have? I have to add the account table or in the method performed in the transientmodel and call it and it is not necessary to add it as manyone?</p>\n", "Lable": "No"}
|
| 2 |
+
{"QuestionId": 58997711, "AnswerCount": 0, "Tags": "<tensorflow><keras>", "CreationDate": "2019-11-22T15:55:18.907", "AcceptedAnswerId": null, "Title": "Keras: Why can't I load weights from file for same model except without dropout?", "Body": "<p>I have two models that are the same except one has a dropout layer removed. If I save the weights from the dropout model (<code>with model.save_weights()</code>) and then try to load into the non-dropout model, I get an error about \"checkpoint references\" or something. What does this mean, and how can I get around it (without leaving dropout in at rate 0.0)?</p>\n", "Lable": "D"}
|
| 3 |
+
{"QuestionId": 59013295, "AnswerCount": 0, "Tags": "<python-3.x><tensorflow>", "CreationDate": "2019-11-23T23:36:17.253", "AcceptedAnswerId": null, "Title": "Prediction results from tensorflow's model.predict_generator for 2 classes", "Body": "<p>I'm trying to learn how to predict results from a model but there seems to be some basic I'm getting confused about. There are two classes I'm working with 0:'cats', 1:'dogs'. When predicting labels for 6 images I get a 6 by 1 array and it seems like the prediction values are for how close the images get to the 'dog' label. I was expecting to get some 6 by 2 array where each image is compared to both classes just like the <a href=\"https://www.tensorflow.org/tutorials/keras/classification\" rel=\"nofollow noreferrer\">Tensorflow basic image classification for clothes</a> tutorial. I also see it may be redundant to generate two prediction values when there are only 2 classes so is my understanding correct? </p>\n\n<p>The code I'm following is the TensorFlow tutorial for image classification:\n<a href=\"https://www.tensorflow.org/tutorials/images/classification\" rel=\"nofollow noreferrer\">https://www.tensorflow.org/tutorials/images/classification</a></p>\n\n<p>To see how the model (called \"model_new\") predicts labels of 6 images (1 cat followed by 5 dogs), I have added the following code with 6 images in the directory ('cat_dog_testing') and then under another sub-directory ('cat_dog_testing'):</p>\n\n<pre><code># Preparing the testing dataset\ntest_dir = os.path.join(os.getcwd(), 'cat_dog_testing')\ntest_image_generator = ImageDataGenerator(rescale=1./255) # scaling pixel values to be from 0 to 1\ntest_generator = test_image_generator.flow_from_directory(batch_size=6,\n directory=test_dir,\n shuffle=False,\n target_size=(IMG_HEIGHT, IMG_WIDTH),\n class_mode=None)\n\nSTEP_SIZE_TEST=test_generator.n//test_generator.batch_size # step size would be 6/6 = 1\ntest_generator.reset()\npred=model_new.predict_generator(test_generator, steps=STEP_SIZE_TEST, verbose=1)\n</code></pre>\n\n<p>For the results:</p>\n\n<pre><code>pred.shape # comes out to be (1,6)\npred # array([[0.26228264],\n# [0.66503084],\n# [0.98268926],\n# [0.97690296],\n# [0.8235555 ],\n# [0.7541907 ]], dtype=float32)\n\n# Visualize test images\n\n# This function will plot images in the form of a grid with 1 row and 6 columns where images are placed in each column.\ndef plotImages(images_arr):\n fig, axes = plt.subplots(1, 6, figsize=(20,20))\n axes = axes.flatten()\n for img, ax in zip( images_arr, axes):\n ax.imshow(img)\n ax.axis('off')\n plt.tight_layout()\n plt.show()\n\nsample_test_images = next(test_generator)\nsample_test_images.shape # comes out to be (6, 150, 150, 3)\nplotImages(sample_test_images[:6])\n</code></pre>\n\n<p><a href=\"https://i.stack.imgur.com/rn4vK.png\" rel=\"nofollow noreferrer\">Here's the order of images plotted and I'm assuming they correspond to the order of predictions</a></p>\n", "Lable": "D"}
|
| 4 |
+
{"QuestionId": 59030519, "AnswerCount": 0, "Tags": "<tensorflow><neural-network><deep-learning><nlp><nlg>", "CreationDate": "2019-11-25T11:15:30.343", "AcceptedAnswerId": null, "Title": "How to get automatic inferences from graphs", "Body": "<p>A bit new to this and getting minimal help from googling.</p>\n\n<p>I want to work on generating automatic inferences from a graph. To start with, Is there any course or blog that can guide me to achieve this. To be in detail, I have a graph, say a basic line graph, If a user hovers on it it should show one or two points/inferences about the graph. All the graphs are basic ones. Inference can be very basic. Can NLP be applied to achieve this?</p>\n\n<p>Thanks in advance.</p>\n", "Lable": "D"}
|
| 5 |
+
{"QuestionId": 59078738, "AnswerCount": 1, "Tags": "<tensorflow><google-colaboratory><tensorflow2.0>", "CreationDate": "2019-11-27T21:33:45.477", "AcceptedAnswerId": "59084298", "Title": "How to improve model to prevent overfitting for very simple image classification", "Body": "<p>First of all: I'm a beginner with TensorFlow (version2). I'm learning a lot by reading. However, I don't seem to find an answer to the following problem.</p>\n\n<p>I'm trying to build a model for classifying images into three labels.\nAs you see in the graphs below my training accurary is quite ok, but the validation accuracy is way too low.</p>\n\n<h2><a href=\"https://i.stack.imgur.com/mxAGV.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/mxAGV.png\" alt=\"Training & Validation Accuracy\"></a></h2>\n\n<p>As I understand, this is probably an 'overfitting' problem.</p>\n\n<p>Maybe I'll first explain what I'm trying to do:</p>\n\n<p>I want to use images as input. As output I'd want to receive zero or more labels (classifiers) that belong to those images.\nI was expecting this would be an easy task, since the input images are simple. (only two colors, and only 0, 1, 2 or 3 possible 'labels'.\nHere are a few examples of the images. They are a representation of a walked track (green) on a field (bounded by blue polygon):</p>\n\n<p><a href=\"https://i.stack.imgur.com/rVaPK.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/rVaPK.png\" alt=\"example input images\"></a></p>\n\n<p>Possible labels are:</p>\n\n<ol>\n<li>cross: (first 2 images): you can see clearly that the green lines are forming one or more 'crosses'</li>\n<li>zig-zag: (third image): not exactly sure if this the is correct term in English, but I guess you get the picture ;-)</li>\n<li>rows: the green lines are mostly parallel lines (no zigzag, nor cross)</li>\n<li>none of above (don't know if this needs to be a label)</li>\n</ol>\n\n<p>I'm using following model:</p>\n\n<pre><code>batch_size = 128\nepochs = 30\nIMG_HEIGHT = 150\nIMG_WIDTH = 150\n\nmodel = Sequential([\n Conv2D(16, 3, padding='same', activation='relu', \n input_shape=(IMG_HEIGHT, IMG_WIDTH ,3)),\n MaxPooling2D(),\n Dropout(0.2),\n Conv2D(32, 3, padding='same', activation='relu'),\n MaxPooling2D(),\n Conv2D(64, 3, padding='same', activation='relu'),\n MaxPooling2D(),\n Dropout(0.2),\n Flatten(),\n Dense(512, activation='relu'),\n Dense(1, activation='sigmoid')\n])\n\n\n\nmodel.compile(optimizer='adam',\n loss='binary_crossentropy',\n metrics=['accuracy'])\n\n\nmodel.summary()\n\nModel: \"sequential_5\"\n_________________________________________________________________\nLayer (type) Output Shape Param # \n=================================================================\nconv2d_15 (Conv2D) (None, 150, 150, 16) 448 \n_________________________________________________________________\nmax_pooling2d_15 (MaxPooling (None, 75, 75, 16) 0 \n_________________________________________________________________\ndropout_10 (Dropout) (None, 75, 75, 16) 0 \n_________________________________________________________________\nconv2d_16 (Conv2D) (None, 75, 75, 32) 4640 \n_________________________________________________________________\nmax_pooling2d_16 (MaxPooling (None, 37, 37, 32) 0 \n_________________________________________________________________\nconv2d_17 (Conv2D) (None, 37, 37, 64) 18496 \n_________________________________________________________________\nmax_pooling2d_17 (MaxPooling (None, 18, 18, 64) 0 \n_________________________________________________________________\ndropout_11 (Dropout) (None, 18, 18, 64) 0 \n_________________________________________________________________\nflatten_5 (Flatten) (None, 20736) 0 \n_________________________________________________________________\ndense_10 (Dense) (None, 512) 10617344 \n_________________________________________________________________\ndense_11 (Dense) (None, 3) 1539 \n=================================================================\nTotal params: 10,642,467\nTrainable params: 10,642,467\nNon-trainable params: 0\n</code></pre>\n\n\n\n<p>I'm using 3360 images as training dataset and 496 as validation dataset. \nThose are already 'augmented' so those sets contain already rotated and mirrored versions of other existing images.</p>\n\n<p>Maybe it is worth to mention that the dataset is unbalanced: 80% of the images do contain the label 'cross', while the other 20% is covered by 'zig-zag' and 'rows'.</p>\n\n<p>Anybody can guide me in the right direction how I can improve my model?</p>\n", "Lable": "D"}
|
| 6 |
+
{"QuestionId": 59084328, "AnswerCount": 0, "Tags": "<react-native><tensorflow><automl>", "CreationDate": "2019-11-28T08:14:36.613", "AcceptedAnswerId": null, "Title": "Can get local JSON data on React native TensorflowJS", "Body": "<p>I use <code>tensorflowjs autoML</code> and there is an issue with this lib. \nI won't explain it, too many unnecessary details.</p>\n\n<p>The point is, it tries to fetch a json data </p>\n\n<p>This works;</p>\n\n<pre><code>const modelJson = 'http://192.168.0.18:8081/src/assets/model.json';\n</code></pre>\n\n<p>This works;</p>\n\n<pre><code>const modelJson = 'http://www.somewhere/api/json';\n</code></pre>\n\n<p>This does not work;</p>\n\n<pre><code>const modelJson = '../src/assets/model.json';\n</code></pre>\n\n<p>Error is;</p>\n\n<pre><code>TypeError: Network request failed\n</code></pre>\n\n<p>I want to collect the JSON on the device, but when it will be on product, how can I use it? Maybe I can use this <code>'http://192.168.0.18:8081/src/assets/model.json'</code> version. Am I gonna get user's ip or what can I do about that.. Thank you very much! </p>\n", "Lable": "D"}
|
| 7 |
+
{"QuestionId": 59086077, "AnswerCount": 0, "Tags": "<spring>", "CreationDate": "2019-11-28T09:56:20.363", "AcceptedAnswerId": null, "Title": "@Value Spring add empttyMap as default Value", "Body": "<p>I have the below code in Spring :\nprivate Map deviceAttributes = new HashMap<>();</p>\n\n<p>Now on static analysis I get the error that I should use @Autowired,@Value,@Resource or @Inject for setting the default value .\nCould someone please let me know how should I use @Value or if anyother from above can be used , please let me know . Thanks in advance , had been struggling with it from quite some time now.</p>\n", "Lable": "No"}
|
| 8 |
+
{"QuestionId": 59089380, "AnswerCount": 0, "Tags": "<tensorflow><keras>", "CreationDate": "2019-11-28T12:53:31.460", "AcceptedAnswerId": null, "Title": "Tensorflow predict throws Error while reading resource variable dense_1_9/kernel from Container", "Body": "<p>Am trying to load keras model in flask to be called from webservice</p>\n\n<pre><code> #__init__ \n...\n self.graph = tf.get_default_graph()\n\n def predict(self, description, taxonomy):\n # set_session(self.session)\n with self.graph.as_default() as graph:\n with tf.Session() as sess:\n set_session(sess)\n x_1 = self.tfidf1.transform(description).toarray()\n x_2 = self.tfidf2.transform(taxonomy).toarray()\n\n results = self.model.predict(x=[x_1, x_2], verbose=1)\n res = self.le.inverse_transform(np.argmax(results, axis=1))\n prob = np.amax(results, axis=1)\n\n return res, prob\n</code></pre>\n\n<p>but it keeps throwing </p>\n\n<pre><code>tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable dense_1_9/kernel from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/dense_1_9/kernel)\n [[{{node dense_1_9/MatMul/ReadVariableOp}}]]\n</code></pre>\n", "Lable": "D"}
|
| 9 |
+
{"QuestionId": 59091544, "AnswerCount": 2, "Tags": "<python><list><dictionary><pytorch><iterable>", "CreationDate": "2019-11-28T14:56:37.357", "AcceptedAnswerId": "59098149", "Title": "In python3: strange behaviour of list(iterables)", "Body": "<p>I have a specific question regarding the behaviour of iterables in python. My iterable is a custom built Dataset class in pytorch:</p>\n\n<pre><code>import torch\nfrom torch.utils.data import Dataset\nclass datasetTest(Dataset):\n def __init__(self, X):\n self.X = X\n\n def __len__(self):\n return len(self.X)\n\n def __getitem__(self, x):\n print('***********')\n print('getitem x = ', x)\n print('###########')\n y = self.X[x]\n print('getitem y = ', y)\n return y\n</code></pre>\n\n<p>The weird behaviour now comes about when I initialize a specific instance of that datasetTest class. Depending on what data structure I pass as an argument X, it behaves differently when I call list(datasetTestInstance). In particular, when passing a torch.tensor as argument there is no problem, however when passing a dict as argument it will throw a KeyError. The reason for this is that list(iterable) not just calls i=0, ..., len(iterable)-1, but it calls i=0, ..., len(iterable). That is, it will iterate until (inclusive) the index equal to the length of the iterable. Obviously, this index is not definied in any python datastructure, as the last element has always the index len(datastructure)-1 and not len(datastructure). If X is a torch.tensor or a list, no error will be risen, even though I think the should be an error. It will still call getitem even for the (non-existent) element with index len(datasetTestinstance) but it will not compute y=self.X[len(datasetTestInstance]. Does anyone know if pytorch handels this somehow gracefully internally?</p>\n\n<p>When passing a dict as data it will throw an error in the last iteration, when x=len(datasetTestInstance). This is actually the expected behaviour I guess. But why does this only happen for a dict and not for a list or torch.tensor?</p>\n\n<pre><code>if __name__ == \"__main__\":\n a = datasetTest(torch.randn(5,2))\n print(len(a))\n print('++++++++++++')\n for i in range(len(a)):\n print(i)\n print(a[i])\n print('++++++++++++')\n print(list(a))\n\n print('++++++++++++')\n b = datasetTest({0: 12, 1:35, 2:99, 3:27, 4:33})\n print(len(b))\n print('++++++++++++')\n for i in range(len(b)):\n print(i)\n print(b[i])\n print('++++++++++++')\n print(list(b))\n</code></pre>\n\n<p>You could try out that snippet of code if you want to understand better what I have observed.</p>\n\n<p>My questions are:</p>\n\n<p>1.) Why does list(iterable) iterate until (including) the len(iterable)? A for loop doesnt do that.</p>\n\n<p>2.) In case of a torch.tensor or a list passed as data X: Why does it not throw an error even when calling the getitem method for the index len(datasetTestInstance) which should actually be out of range since it is not defined as an index in the tensor/list? Or, in other words, when having reached the index len(datasetTestInstance) and then going into the <strong>getitem</strong> method, what happens exactly? It obviously doesnt make the call 'y = self.X[x]' anymore (otherwiese there would be an IndexError) but it DOES enter the getitem method which I can see as it prints the index x from within the getitem method. So what happens in that method? And why does it behave different depending on whether having a torch.tensor/list or a dict?</p>\n", "Lable": "D"}
|
| 10 |
+
{"QuestionId": 59107933, "AnswerCount": 1, "Tags": "<python><keras><callback>", "CreationDate": "2019-11-29T15:58:29.197", "AcceptedAnswerId": null, "Title": "How to manupilate input tensor epochwise in keras", "Body": "<p>I'm new to Keras and I have a project written in Keras which I want to modify it slightly. My idea is adding random noise to random samples of the the input tensor each epoch. So in every epoch, random indices of the input data will be corrupted with the noise. </p>\n\n<p>If I inject noise to the features before feeding to keras <code>model.fit()</code> noise will be added to the same samples of the input tensor and will stay same during whole training. But I want to change random samples after each epoch. </p>\n\n<p>Therefore, I tried to use Callbacks:</p>\n\n<p><div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\r\n<div class=\"snippet-code\">\r\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>class Noisify(Callback):\r\n def __init__(self,mixture_rate = 0.2):\r\n self.mixture_rate = mixture_rate\r\n \r\n def on_epoch_begin(self,epoch,logs={}):\r\n # get input tensor\r\n \r\n '''\r\n mix randomly noisy and clean features here\r\n \r\n '''\r\n \r\n # set input tensor</code></pre>\r\n</div>\r\n</div>\r\n</p>\n\n<p>But I couldn't find a way to get and set input tensor like <code>model.get_layer</code> or <code>get_weights</code>. How can do it? </p>\n", "Lable": "D"}
|