小编pbu*_*pbu的帖子

使用cuDNN编译Caffe的问题

我试图用750ti geforce gpu在ubuntu14上编译caffe,但我不能.我在/ usr/local/cuda/lib64中安装了cudnn库,而/ usr/local/cuda/include中的cudnn.h头文件仍然存在问题.我真的认为在Makefile.config中启用cudNN = 1

# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
Run Code Online (Sandbox Code Playgroud)

那就是问题所在.究竟是什么错误?

./include/caffe/util/cudnn.hpp:65:5: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
     ^
./include/caffe/util/cudnn.hpp:65:12: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
            ^
./include/caffe/util/cudnn.hpp:65:19: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
                   ^
./include/caffe/util/cudnn.hpp:65:26: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
                          ^ …
Run Code Online (Sandbox Code Playgroud)

cuda caffe

5
推荐指数
1
解决办法
8495
查看次数

谷歌地图 iframe 加载速度很慢

我在 wordpress 中写了一篇文章,并使用 google iframe 加载 35 个国家的国家地图。换句话说,我正在加载 35 个 google 地图 iframe 以及 100 个其他 640px 中等尺寸图像。我写的文章大小约为31 mb。

文章加载大约需要 15 秒,在移动浏览器中加载情况更糟。有时谷歌地图会导致文章内容长时间停止加载。

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d5662268.557666768!2d-2.2908874246415487!3d46.135220605972364!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0xd54a02933785731%3A0x6bfd3f96c747d9f7!2sFrance!5e0!3m2!1sen!2shu!4v1483719195954" width="400" height="300" frameborder="0" style="border:0" allowfullscreen></iframe>
Run Code Online (Sandbox Code Playgroud)

如何加快加载速度?有什么简单的方法可以做到这一点吗?

我使用过像延迟加载这样的 WordPress 插件,但这只会让加载变得更糟并且卡住。我是一个超级使用 WordPress 超级缓存的人。

wordpress iframe google-maps

5
推荐指数
1
解决办法
1万
查看次数

HDF5-DIAG:在HDF5中检测到错误(1.8.11)

我试图在caffe中加载hdf5,它不起作用.我检查了路径,甚至能够使用viewer查看hdf文件.一切都很好,但似乎无法加载.

我使用像这样的python脚本编写hdf5,其中X和标签是numpy数组.

f = h5py.File("facialkp.hd5", "w")
f.create_dataset("data", data=X,  compression="gzip", compression_opts=4)
f.create_dataset("label", data=labels,  compression="gzip", compression_opts=4)
Run Code Online (Sandbox Code Playgroud)

这是整个问题.

root@pbu-OptiPlex-740-Enhanced:/home/pbu/Desktop# ./facialkp_train.sh
I0119 19:55:50.779419  9905 caffe.cpp:103] Use CPU.
I0119 19:55:51.152626  9905 caffe.cpp:107] Starting Optimization
I0119 19:55:51.152817  9905 solver.cpp:32] Initializing solver from parameters: 
test_iter: 1000
test_interval: 1000
base_lr: 0.01
display: 1000
max_iter: 10000
lr_policy: "step"
gamma: 0.1
momentum: 0.9
weight_decay: 0.0005
stepsize: 5000
snapshot: 10000
snapshot_prefix: "/home/pbu/Desktop/tmp"
solver_mode: CPU
net: "/home/pbu/Desktop/facialkp.prototxt"
I0119 19:55:51.152936  9905 solver.cpp:67] Creating training net from net file: /home/pbu/Desktop/facialkp.prototxt
I0119 19:55:51.153211  9905 net.cpp:39] …
Run Code Online (Sandbox Code Playgroud)

python numpy hdf5 caffe

4
推荐指数
1
解决办法
5185
查看次数

在 Pandas 中将字符串的数据框列合并为一列

我在包含这样的文本的数据框中(从 CSV 导入)中有列。

"New york", "Atlanta", "Mumbai"
"Beijing", "Paris", "Budapest"
"Brussels", "Oslo", "Singapore"
Run Code Online (Sandbox Code Playgroud)

我想将所有列折叠/合并为一列,就像这样

New york Atlanta
Beijing Paris Budapest
Brussels Oslo Singapore
Run Code Online (Sandbox Code Playgroud)

如何在熊猫中做到这一点?

python pandas

4
推荐指数
1
解决办法
960
查看次数

MySQL使我的网站加载速度非常慢

我似乎无法找到问题所在.

我的主页需要5秒才能加载,我怀疑它是因为MySQL.当我在浏览器中输入我的网站网址时,我必须等待5秒才会加载.

我有运行intel celeron的专用服务器,带有1GB RAM的centos.我的数据库大小约为650mb,有20万条记录,我为日期,id等创建了索引.

这是我在主页中使用的SQL查询:

select `id`,`title`,`desc`,`contribution`,`date`,`sponsored`                
from tbl_releases where date <= CURRENT_DATE()  AND approved='1' 
order by `date` desc,`sponsored` desc,`con` desc,`id` desc
limit 100
Run Code Online (Sandbox Code Playgroud)

我尝试了所有的一切

  1. 使用my.cnf优化缓冲区等但不提高网站性能.
  2. 优化表.

PS:数据库大小对性能有影响吗?我在数据库中有超过50%的垃圾,删除无用行有助于提高性能?


更新:我在数据库中做了清理垃圾并且性能得到了显着改善,我注意到服务器负载和mysql cpu使用率从36%大幅下降到仅5%.但仍然是我不明白,为什么mysql正在减慢这么大的数据,它应该几乎处理那么多的数据.不是吗?

顺便说一下,我使用的是智能引擎,尽管如此,网站正在放慢速度.

php mysql

3
推荐指数
1
解决办法
4651
查看次数

在Pandas中编码列标签以进行机器学习

我正在研究机器学习的汽车评估数据集,数据集是这样的

buying,maint,doors,persons,lug_boot,safety,class
vhigh,vhigh,2,2,small,low,unacc
vhigh,vhigh,2,2,small,med,unacc
vhigh,vhigh,2,2,small,high,unacc
vhigh,vhigh,2,2,med,low,unacc
vhigh,vhigh,2,2,med,med,unacc
vhigh,vhigh,2,2,med,high,unacc
Run Code Online (Sandbox Code Playgroud)

我想将这些字符串按列转换为唯一的枚举整数.我看到pandas.factorize()是要走的路,但它只适用于一列.如何使用一个命令一次性分解数据帧.

我尝试了lambda功能,但它无法正常工作.

df.apply(lambda c:pd.factorize(c),axis = 1)

输出:

   0     ([0, 0, 1, 1, 2, 3, 4], [vhigh, 2, small, low,...

    1     ([0, 0, 1, 1, 2, 3, 4], [vhigh, 2, small, med,...

    2     ([0, 0, 1, 1, 2, 3, 4], [vhigh, 2, small, high...

    3     ([0, 0, 1, 1, 2, 3, 4], [vhigh, 2, med, low, u...

    4       ([0, 0, 1, 1, 2, 2, 3], [vhigh, 2, med, unacc])

    5     ([0, 0, 1, …
Run Code Online (Sandbox Code Playgroud)

python machine-learning pandas scikit-learn

3
推荐指数
1
解决办法
3109
查看次数

如何在numpy中将4d数组重塑为2d数组

我有一个像这样的 4d 形状数组。它总共有 18*100 = 1800 行和每行 30 维输出

(18, 100, 30, 1, 1)
Run Code Online (Sandbox Code Playgroud)

我想将其转换或重塑为二维数组,这是最简单的方法

(1800,30)
Run Code Online (Sandbox Code Playgroud)

对不起,我对 numpy 太天真了,但请我是一个新手用户。非常感谢任何帮助。

numpy reshape python-2.7

3
推荐指数
1
解决办法
1万
查看次数

带有AdaptiveThreshold的OpenCV错误

我正在尝试通过openCV捕获视频,然后在视频上应用自适应阈值(以转换为黑白)。问题是此代码经常引发错误。我在自适应阈值功能中处理最后两个数字。

cv2.error: /tmp/opencv-UA2sOU/opencv-2.4.9/modules/imgproc/src/thresh.cpp:797: error: (-215) blockSize % 2 == 1 && blockSize > 1 in function adaptiveThreshold

我似乎无法理解导致此问题的原因。

import numpy as np
import cv2
import pylab as pl

cap = cv2.VideoCapture(0)


# take first frame of the video
ret,frame = cap.read()

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read() 
    thresh = cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,40,15)

    cv2.imshow('frame',thresh)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        #cv2.imwrite("snap.jpg", thresh)
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)

python opencv

3
推荐指数
1
解决办法
2296
查看次数

存储为numpy的图像中的XY坐标?

我有一个96x96像素的numpy数组,这是一个灰度图像.如何找到并绘制此图像中最大像素强度的x,y坐标?

image =(96,96)

看起来很简单,但我可以找到任何代码片段.请你帮忙:)

numpy image-processing matplotlib scikit-learn

2
推荐指数
1
解决办法
1438
查看次数

Cmake错误x86_64的未定义符号

我正在尝试使用xcode在我的mac osx yosemite中编译conv-net库.我甚至将标志设置为libstdc ++仍然没有正确链接.

我仍然得到架构x86_64的未定义符号.任何帮助非常感谢.

sh-3.2# ./compile.sh
Building conv-net library
-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting …
Run Code Online (Sandbox Code Playgroud)

c++ macos compilation cmake

0
推荐指数
2
解决办法
4125
查看次数