小编kow*_*abu的帖子

无法在 Windows 中安装 pycocotools:致命错误 C1083:无法打开包含文件:'io.h':没有此类文件或目录错误:

我是机器学习的新手,已经开始使用配备 GeForce GTX 540M 的 Windows 8.1 电脑。我按照本教程开始使用对象检测模型。我构建了自己的数据集并尝试按照教程对其进行训练,但使用“ssd_mobilenet_v1_coco_2017_11_17”模型。但是无法成功执行,因为我在使用教程中给出的“train.py”文件时遇到了麻烦。

所以我用谷歌搜索,发现我们必须使用“model_main.py”来训练模型。在尝试使用“model_main.py”进行训练时,出现此错误:
"ImportModuleError: No module named 'pycocotools' was found"

所以我尝试从这个链接安装 cocoapi 。我按照给定的说明进行操作,但遇到了下面显示的错误,我尝试了很多解决方案,但没有任何效果。任何帮助都感激不尽。

(tensorflow1) C:\tensorflow1\models\research\object_detection>pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
  Cloning https://github.com/philferriere/cocoapi.git to c:\users\home\appdata\l
ocal\temp\pip-req-build-76t4e6ys
Building wheels for collected packages: pycocotools
  Running setup.py bdist_wheel for pycocotools ... error
  Complete output from command c:\users\home\anaconda3\envs\tensorflow1\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Home\\AppData\\Local\\Temp\\pip-req-build-76t4e6ys\\PythonAPI\\setup.py';f=getattr(tokenize, 'open',open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Home\AppData\Local\Temp\pip-wheel-4_r37hm6 --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\pycocotools
  copying pycocotools\coco.py …
Run Code Online (Sandbox Code Playgroud)

python windows object-detection tensorflow pycocotools

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

正则表达式查找部分输入是否是有效的 JSON

我有一个场景,我需要验证部分输入(见下文)是否是有效的 JSON?我引用了这个答案来确定给定的字符串是否是有效的 JSON。

输入示例:

 { 
 "JSON": [{
      "foo":"bar",
      "details": {
           "name":"bar",
           "id":"bar",
Run Code Online (Sandbox Code Playgroud)

到目前为止我已经尝试过:

/ (?(DEFINE)
         (?<number>   -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
         (?<boolean>   true | false | null )
         (?<string>    " ([^"\n\r\t\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
         (?<array>     \[  (?:  (?&json)  (?: , (?&json)  )*  )?  \s* \]{0,1} )
         (?<pair>      \s* (?&string) \s* : (?&json)  )
         (?<object>    \{  (?:  (?&pair)  (?: , (?&pair)  )*  )?  \s* \}{0,1} )
         (?<json> …
Run Code Online (Sandbox Code Playgroud)

java regex json pcre

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

如何从多个线程写入 TcpListener?

假设我有一个静态列表List<string> dataQueue,其中数据不断以随机间隔且以不同的速率(1-1000 个条目/秒)添加。

我的主要目标是将列表中的数据发送到服务器,我正在使用一个TcpClient类。

到目前为止我所做的是,我在单线程中将数据同步发送到客户端

byte[] bytes = Encoding.ASCII.GetBytes(message);

tcpClient.GetStream().Write(bytes, 0, bytes.Length);
//The client is already connected at the start
Run Code Online (Sandbox Code Playgroud)

发送数据后,我会从列表中删除该条目。

这工作正常,但发送数据的速度不够快,随着列表被逐一迭代和发送,列表会被填充并消耗更多内存。

我的问题是我可以使用同一个tcpClient对象从另一个线程并发写入,或者我可以tcpClient在另一个线程中使用另一个对象与同一服务器的新连接吗?将此数据发送到服务器的最有效(最快)的方法是什么?

PS:我不想使用UDP

c# tcpclient

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