Uploaded images do not show on localhost

I'm working with Wordpress 3.3.1 on a local installation. I've uploaded an image file and it doesn't show up. The base directory is a symbolic link /var/www/wordpress/ that leads to /usr/share/wordpress/ The file exists here: /srv/www/wp-uploads/localhost/2013/01/Logo.png Wordpress thinks the file is here: http://localhost/wordpress/2013/01/Logo.png (Apache gives 404) How can I configure Apache or Wordpress to get the correct file? I'm confused because /srv/www/localhost/ contains the Wordpress files (as well). Also, I've found questions related to wp-content/uploads but this directory doesn't exist.
Category: Web

Multi-Label time-series classification with LSTM: large performance decrease for longer periods

I have daily data on event occurences, so for each day I have a vector like [1, 0, 1] indicating that on this day event one and three occured, but event two did not occur. I want to train a model to take data from the past number of days (n_days) and to then predict the event occurences for the next day. I believe this problems falls into the category of multi-label classification. Moreover, the data that I use has …
Category: Data Science

Graph Neural Networks for Segmented Images - Which Nodes do I connect?

I'm facing an interesting problem involving medical images. We are set out to test an hypothesis if certain objects in an image affect the diagnosis of a patient. I would love to hear any comments regarding my pipeline but this is my current approach: Segment the image in order to obtain the object's regions. This would be done using off-the-shelf resnet and labeled data obtained from the manual annotation of the images in hand. Now, that I have the segmented …
Category: Data Science

My authors need to be able to preview their upload images and manipulate and scale

I am using a form and that form allows for IMAGE UPLOAD. After submission the form redirects and then they can see the reviewed post - however if the image which they uploaded blindly does not look good needs to be moved and scaled to best advantage how can they do this in the post. When I upload my profile pic to most apps I can place it and move it to best advantage within their mask - I want …
Category: Web

subdirectory index.php is not working

I have setup wordpress in the root directory and at the same level I have some other directories e.g named "sq". Under sq there are subdirectories like first, second, ... under each subdirectory there is index.php file. Problem is when I am accessing http://example.com/sq/first it is giving me 404 page of root wordpress. I tried index.html instead of index.php and that is working. So index.php is not woking and I need php not html. I have tried all the possible …
Category: Web

Is there a sensible notion of 'character embeddings'?

There are several popular word embeddings available (e.g., Fasttext and GloVe); In short, those embeddings are a tool to encode words along with a sensible notion of semantics attached to those words (i.e. words with similar sematics are nearly parallel). Question: Is there a similar notion of character embedding? By 'character embedding' I understand an algorithm that allow us to encode characters in order to capture some syntactic similarity (i.e. similarity of character shapes or contexts).
Category: Data Science

Crop image without scaling or resizing with add_image_size()

Both of these tend to shrink the image and then crop it to the dimensions listed. What I want is to just crop out the center of the image at 475 x 310 add_image_size( 'test', 475, 310, array( 'center', 'center' ) ); add_image_size( 'test2', 475, 310, true ); BTW I'm using the regenerate-thumbnails plugin to recreate all the images after I make a new add_image_size() deceleration. Here is an image 1400 x 788 pixels, where I added a pink box …
Category: Web

resnet50 implementation for semantic segmentation

I am new to resnet models. I want to implement a resnet50 model for semantic segmentation I am following the code from this video, but my numclasses is 21. I have a few questions: If i pass in any rgb jpeg image into the model, I get an output of size (1, 21). What does this output represent? Since I am doing semantic segmentation, my images dont have any rgb channels, so what should I put for image_channels in self.conv1? …
Category: Data Science

WP_Query not returning custom post type

I'm using the below code to try to return the count of custom post types but the query isn't finding anything. I change the post_type to project and it works fine. This is also being used outside of the loop if that makes a difference? function get_user_posts_count($user_id, $post_type) { $args['author'] = 1; $args['post_type'] = 'project'; $args['posts_per_page'] = -1; $args['post_status'] = 'any, trash'; $ps = new WP_Query( $args ); echo var_dump ($ps); }
Category: Web

Enqueueing Script to footer puts it at the very bottom

So I've got a bit of an issue, and not sure what the problem is. I'm trying to enqueue javascript in the footer of my Wordpress site. The footer looks like this: </footer> </div> <?php wp_footer(); ?> <script> jQuery(document).foundation(); </script> </body> </html> So the enqueued script SHOULD be put in the wp_footer call, putting the script just above where I actually call it. But looking at the source code of the file, I get this: </footer> </div> <script> jQuery(document).foundation(); </script> …
Category: Web

MR images segmentation for feature extraction

I have datasets of brain MR images with tumours, the tumours are already selected manually by a physicist using Image J. I have read about segmentation, but I still couldn't understand how do they extract features from a segmented image. should the images have only the tumor with a black background as shown in the below images, so the feature extraction will be processed on the whole image? or do they extract features only on the region of interest using …
Category: Data Science

Label images on-the-fly

I have a code in which it downloads images from Google image according to a query. All those queries are cars (different branch, model and year). Since it is difficult to label each image with a given label (branch_model_year), I would like to first identify the car inside the image and then label it as (branch_model_year). I've used Yolov3 + Darknet to identify the object within the object. See image. How can I change this label for a future classification? …
Category: Data Science

How to handle a feature vector that could be variable length?

I would like to train a machine learning model with several features as input as X[] and with one output as Y. For example Every sample has a Data frame like this: X[0], X[1], X[2], X[3], X[4], Y Let's say One sample the followings Data is only one value: X[0], X[1], X[2], X[4], Y This is normal machine training problem. But now, if I would like to set X[3] multiple values for example sample 1 Data is: X[0] | X[1] …
Category: Data Science

WordPress and plugins can't update ("inconsistent file permissions" error)?

I have a problem - when I click on "Wordpress update", I receive this message: Downloading update from https://downloads.wordpress.org/release/wordpress-5.1-new-bundled.zip… Unpacking the update… The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php Installation Failed I changed permissions: WP-admin and WP-includes to 755 WP-content to 777 All files in WP-admin are 755. What can be the problem? I am trying to solve it, but I can't do it.
Category: Web

sklearn FutureWarning message when running a CNN model

When I run my model, I am receiving the following error message: FutureWarning: Pass classes=[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24], y=[20 16 4 ... 2 2 2] as keyword args. From version 0.25 passing these as positional arguments will result in an error FutureWarning) I am assuming I need to pass them as keyword args. I am new to the …
Category: Data Science

Plot of ACF & PACF

There are 96 observations of energy consumption per day from 01/05/2016 - 31/05/2017. I am trying an ARIMA model in R to be fitted to these time series observations. I have chosen the frequency of time series as 96. In total, there are 38016 observations. I have cleaned the series using tsclean command in R to remove the outliers. timeseries <- ts(full$consumption, frequency = 96) Cleansed time series: timeseries <- tsclean(timeseries) I have then differenced the series: diffts <- diff(timeseries) …
Topic: time-series r
Category: Data Science

Split content into multiple columns using more tag?

First of, this is pretty much an exact duplicate of: Split columns into three+ divs? But the given solution does not work (returns blank). I'm guessing it collides with qTranslate which adds some really weird comments to the html, but i'm not sure. I found a great code snippet that simply splits the content into pieces by the more tag. The problem is it seems to only split into two columns. It ignores the rest of the more tags. I …
Category: Web

Change Category Base For Custom Post Type or Posts Page

I have a few questions and I don't think the outcome I want is possible without adding a custom taxonomy and redoing a bunch of work. I have registered a custom post type - gallery - with taxonomies set to post_tag and category. I have the permalink structure set to /blog/%postname%/ so Posts can have the /blog/ base set using the default Posts section within WordPress. When I use get_category_link() for a category on the gallery custom post type, it …
Category: Web

Converting data format

I'm trying to use the recent COVID-19 data from the site of Italian Civil Protection, but they use a rather complicated time format that I'm finding troublesome as a novice to plot as data in a graph. This is how the data is presented: [1] 2020-02-24T18:00:00 2020-02-25T18:00:00 2020-02-26T18:00:00 2020-02-27T18:00:00 2020-02-28T18:00:00 2020-02-29T18:00:00 and I would like to use the format as DD-MM, without the time and the year. How can I do it?
Category: Data Science

Add action hook into wp_localize_script

Is it possible to add an action hook via wp_localize_script, so I can position where I want the hook to run in HTML markup that is made in the JavaScript? So something like: $data = array ( 'ng_slicknav' => array( 'ng_slicksearch' => home_url( '/' ), 'ng_slicknav_closedsymbol' => esc_html( $options['ng_slicknav_closedsymbol'] ), 'ng_slicknav_hook' => do_action( 'myplugin_after_hook' ), ), ); // Add filter $data = apply_filters( 'ng_slicknav_slickNavVars', $data ); // Pass PHP variables to jQuery script wp_localize_script( 'slicknav-init', 'slickNavVars', $data ); wp_enqueue_script( 'slicknav-init' …
Category: Web

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies set up to mimic the post types so for every Company A entered into Company post type, there is Company A, I manually entered Company A into Company taxonomy. That way, when I do a regular post about Company A, I can effectively tag …
Category: Web

Missing population values in census data

I have population data from Census.gov: Total US population by age by year from 1940 through 2010 Depending on the range of decades, the data is missing discrete population values for ages greater than a certain age. Instead an aggregate amount is provided that represents all ages greater than the cutoff. Specifically it follows this pattern: 1940 to 1979: Discrete data from 0 to 84 and aggregate for ages 85 and greater 1980 to 1999: Discrete data from 0 to …
Category: Data Science

How to train NER LSTM on single sentence level

My documents are only a single sentence long, containing one annotation. Sentences with the same named entity of course are similar, but not context-wise. NER training examples (afaik) always has documents sequentially related, aka the next document is context-wise related to the previous document. Consider the example below. The first sentence is about the US, with location annotations. The second sentence is about an organisation but still related to the previous. The United States of America (LOC), commonly known as …
Category: Data Science

Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?

I am creating a shortcode that outputs a custom loop. Within the loop while, I am injecting certain content after a particular post count. This is done by checking the current_post number. This particular function is quite long (and filled with commented-out code, from testing). Here is a link to my current version (currently with ALL posts on a single page): https://gist.github.com/Garconis/c93ce89c3d378bfb7f5d8df97acbebc2 This works fine if/when ALL posts (posts_per_page => -1) are showing, but as soon as I add pagination …
Category: Web

Site redirects to wrong url when saving settings

I have a subdomain: https://blog.example.com/ I forcibly redirects to subdirectory: https://www.example.com/blog By changing site URL and some RewriteRule on .htaccess. Now the website and admin works fine except a small issue like when I tried to click save button on settings page (eg: Setting > Writing ) the site redirects to main domain: https://www.example.com/wp-admin/options-writing.php?settings-updated=true /blog is missing in the URL and end up in to main website 404 page. My .htaccess file looks like : # BEGIN WordPress <IfModule mod_rewrite.c> …
Category: Web

Get Gate Activation of GRU-Cells in TensorFlow

I implemented a standard RNN in Tensorflow (0.12) using the classes tf.python.ops.rnn_cell.GRUCell tf.nn.dynamic_rnn I am interested in the gates and which values they take during. Unfortunately the function dynamic_rnn doesn't support this and just gives the 'output' and 'state' (The final hidden state). In the code of the GRUCell the gates are called 'r' and 'u' for reset and update. Is there a clever way to save the values of the gates over time or do I have to write …
Topic: tensorflow
Category: Data Science

Coloring labels using scatterplot3d in R

I am trying to visualize data using R and scatterplot3d. I have loaded data and used: colors <- c("#999999", "#E69F00", "#56B4E9" ) scatterplot3d(output$X2,output$X6 , output$X7 , color=colors, pch="X9") X9 is label column in my dataset. it contains 3 categories : A , B , C. By documentation: color : colors of points in the plot, optional if x is an appropriate structure. Will be ignored if highlight.3d = TRUE. pch: plotting "character", i.e. symbol to use. Yet I still get …
Category: Data Science

admin-ajax.php 400 bad request - whats wrong with my code?

I'm getting a 400 bad request from admin-ajax.php & warnings from pagespeed insights tell me it's an issue. Can you see any obvious issues in the code in our admin-ajax.php file? <?php /** * WordPress Ajax Process Execution * * @package WordPress * @subpackage Administration * * @link https://codex.wordpress.org/AJAX_in_Plugins */ /** * Executing Ajax process. * * @since 2.1.0 */ define( 'DOING_AJAX', true ); if ( ! defined( 'WP_ADMIN' ) ) { define( 'WP_ADMIN', true ); } /** Load WordPress …
Category: Web

Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess

For a long time I served my blog from http://www.murrayc.com/blog/, with the wordpress installation in /home/murrayc/murrayc.com/blog/. Now I've moved it to http://www.murrayc.com/, without moving the wordpress installation on the filesystem. I did that by: Changing the "Site Address (URL)", in Settings->General, to http://www.murrayc.com. I kept the "WordPress Address (URL)" as http://www.murrayc.com/blog Adding a RedirectRule in my top-level .htaccess at /home/murrayc/murrayc.com/, so that, for instance, permalink/something could be used instead of blog/permalink/something. The older blog/permalinks still seem to work too. However, …
Category: Web

OpenCV warpAffine error during image augmentation using Albumentations

I have been trying to do image augmentation using a library called Albumentations. But I got some error from OpenCV while transforming the images. I ran the code below on Kaggle's notebook. The dataset is called "Intel image classification" on kaggle. It has 6 classes. Each image is 150 * 150 * 3. import numpy as np import tensorflow as tf import albumentations as a train_data = tf.keras.utils.image_dataset_from_directory( x_train_path, seed=123, image_size=(150, 150), batch_size=128) x_train_path = "../input/intel-image-classification/seg_train/seg_train" transforms = Compose([ a.Rotate(limit=40), …
Category: Data Science

Mapping between original feature space and an interpretable feature space

I'm reading the following really interesting paper https://arxiv.org/pdf/1602.04938.pdf on local interpretable model explanations on page 3 however particularly section 3.3 Sampling for Local Exploration they mention obtaining perturbed samples $z' \in \{0,1\}^{d'}$, it then says "we recover the sample in the original representation $z \in \mathbb{R}^{d}$ and obtain $f(z)$ " with no indication how this is done, surely the map is not injective? If not how would you know you recovered the correct sample? To this end, i wondering how …
Category: Data Science

Multisite Redirection to new domains

I have a multisite website with 5 domains in WordPress which uses WordPress MU Domain Mapping plugin. I want to redirect every subpage to new domain, but we will be still using the homepage, because it contains some links inside of it, so root, wp-admin and wp-login, should be still accessible and not redirected. How to set this up in .htaccess so WordPress will still function? example of a domain: oldone.com/ --> no redirection oldone.com/wp-admin --> no redirection oldone.com/wp-login --> …
Category: Web

Recurrent Neural Networks Over Multiple Documents Over Time

So in my head, I have an idea about what this architecture should look like, or at least behave, but I am having trouble implementing it. So let me describe the problem, and if anyone has an idea on how to actually implement it let me know. Or if I am over-thinking a solution. I am trying to classify accounts into one of two groups, good and bad. I have multiple text documents per account. What I want to do …
Category: Data Science

how to align sliding window to extract features from multi modal timeseries data?

I have two datasets that are collected at different frequencies at the same time. One is recorded at 128Hz and another one is recorded at 512 Hz. I am trying to extract some features using the moving window technique but I have some problems. Frequencies of both datasets are different. the timestamp is in unix format and changes in nanoseconds. hence there won't be any match at the start and end of each second or minute. one of the datasets …
Category: Data Science

How can I train a model to modify a vector by rewarding the model based on the modified vectors nearest neighbors?

I am experimenting with a document retrieval system in which I have documents represented as vectors. When queries come in, they are turned to vectors by the same method as used for the documents. The query vector's k nearest neighbors are retrieved as the results. Each query has a known answer string. In order to improve performance, I am now looking to create a model that modifies the query vector. What I was looking to do was use a model …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.