NetYea套件新增Line@漂浮圖標
在電腦版或是手機板都能讓客戶更容易找到你
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
1. 到 Github 下載 tesseract-ocr-w64-setup-5.3.3.20231005.exe 來安裝Tesseract。
2. 記錄Tesseract安裝的路徑,預設路徑通常為 C:\Program Files\Tesseract-OCR。
3. 將Tesseract.exe路徑新增到環境變數中
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
Python中執行Pytesseract模組錯誤 - 錯誤訊息
- raise TesseractNotFoundError()
- pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
在測試 mnist 數字辨識時
代碼來源
https://hackmd.io/@Maxlight/SkuYB0w6_#3-hyperparameter
- import torch
- from torch.utils import data as data_
- import torch.nn as nn
- from torch.autograd import Variable
- import matplotlib.pyplot as plt
- import torchvision
- import os
-
- EPOCH = 1
- BATCH_SIZE = 50
- LR = 0.001
- DOWNLOAD_MNIST = False
-
- train_data = torchvision.datasets.MNIST(root = './mnist',train = True,transform = torchvision.transforms.ToTensor(),download = DOWNLOAD_MNIST)
-
- print(train_data.train_data.size())
- print(train_data.train_labels.size())
- plt.ion()
- for i in range(11):
- plt.imshow(train_data.train_data[i].numpy(), cmap = 'gray')
- plt.title('%i' % train_data.train_labels[i])
- plt.pause(0.5)
- plt.show()
-
- train_loader = data_.DataLoader(dataset = train_data, batch_size = BATCH_SIZE, shuffle = True,num_workers = 2)
-
- test_data = torchvision.datasets.MNIST(root = './mnist/', train = False)
- test_x = torch.unsqueeze(test_data.test_data, dim = 1).type(torch.FloatTensor)[:2000]/255.
- test_y = test_data.test_labels[:2000]
-
- class CNN(nn.Module):
- def __init__(self):
- super(CNN, self).__init__()
- self.conv1 = nn.Sequential(
- nn.Conv2d(in_channels = 1, out_channels = 16, kernel_size = 5, stride = 1, padding = 2,),# stride = 1, padding = (kernel_size-1)/2 = (5-1)/2
- nn.ReLU(),
- nn.MaxPool2d(kernel_size = 2),
- )
- self.conv2 = nn.Sequential(
- nn.Conv2d(16, 32, 5, 1, 2),
- nn.ReLU(),
- nn.MaxPool2d(2)
- )
- self.out = nn.Linear(32*7*7, 10)
-
- def forward(self, x):
- x = self.conv1(x)
- x = self.conv2(x)
- x = x.view(x.size(0), -1)
- output = self.out(x)
- return output, x
-
- cnn = CNN()
- print(cnn)
-
- optimization = torch.optim.Adam(cnn.parameters(), lr = LR)
- loss_func = nn.CrossEntropyLoss()
-
- for epoch in range(EPOCH):
- for step, (batch_x, batch_y) in enumerate(train_loader):
- bx = Variable(batch_x)
- by = Variable(batch_y)
- output = cnn(bx)[0]
- loss = loss_func(output, by)
- optimization.zero_grad()
- loss.backward()
- optimization.step()
-
- if step % 50 == 0:
- test_output, last_layer = cnn(test_x)
- pred_y = torch.max(test_output, 1)[1].data.numpy()
- accuracy = float((pred_y == test_y.data.numpy()).astype(int).sum()) / float(test_y.size(0))
- print('Epoch: ', epoch, '| train loss: %.4f' % loss.data.numpy(), '| test accuracy: %.2f' % accuracy)
-
- test_output, _ = cnn(test_x[:10])
- pred_y = torch.max(test_output, 1)[1].data.numpy()
- print(pred_y, 'prediction number')
- print(test_y[:10].numpy(), 'real number')
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
ubuntu firefox播放久了,突然不能用了
顯示
ubuntu firefox youtube cannot play


安裝插件
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
結果圖:

座標:
- [[ 16 290]
- [412 491]
- [740 626]
- [283 631]
- [146 651]
- [ 32 710]]
- 5.0
- image 1/1 D:\yolo\bus.jpg: 640x480 4 persons, 1 bus, 1 stop sign, 83.9ms
- Speed: 3.0ms preprocess, 83.9ms inference, 4.0ms postprocess per image at shape (1, 3, 640, 480)
- tensor([[ 22.3412, 228.0822, 802.0841, 754.3939]], device='cuda:0')
- 準確率 0.879738450050354
- x,y: [[412 491]]
- 0.0
- tensor([[ 47.5999, 398.8344, 244.2552, 903.1386]], device='cuda:0')
- 準確率 0.873720109462738
- x,y: [[146 651]]
- 0.0
- tensor([[670.3670, 376.9174, 810.0000, 875.0829]], device='cuda:0')
- 準確率 0.8693700432777405
- x,y: [[740 626]]
- 0.0
- tensor([[220.5713, 405.7240, 344.5589, 857.2506]], device='cuda:0')
- 準確率 0.819391667842865
- x,y: [[283 631]]
- 11.0
- tensor([[7.7698e-02, 2.5441e+02, 3.2119e+01, 3.2465e+02]], device='cuda:0')
- 準確率 0.44594067335128784
- x,y: [[ 16 290]]
- 0.0
- tensor([[3.2650e-02, 5.4988e+02, 6.4001e+01, 8.6930e+02]], device='cuda:0')
- 準確率 0.29976797103881836
- x,y: [[ 32 710]]
-
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
訓練強大且準確的目標偵測模型需要全面的資料集。本指南介紹了與 Ultralytics YOLO 模型相容的各種資料集格式,並深入了解其結構、用法以及如何在不同格式之間進行轉換。
支援的資料集格式Ultralytics YOLO 格式
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
- Model summary (fused): 168 layers, 3011108 parameters, 0 gradients
- Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 1/1 [00:00<00:00, 45.58it/s]
- all 12 12 0 0 0 0
- Traceback (most recent call last):
- File "D:\yolo\testyolo.py", line 13, in <module>
- model.train(data="data.yaml",
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\engine\model.py", line 334, in train
- self.trainer.train()
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\engine\trainer.py", line 195, in train
- self._do_train(world_size)
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\engine\trainer.py", line 418, in _do_train
- self.final_eval()
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\engine\trainer.py", line 573, in final_eval
- self.metrics = self.validator(model=f)
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
- return func(*args, **kwargs)
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\engine\validator.py", line 190, in __call__
- self.print_results()
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\models\yolo\detect\val.py", line 165, in print_results
- names=self.names.values(),
- AttributeError: 'str' object has no attribute 'values'
- Exception in thread Thread-12 (plot_images):
- Traceback (most recent call last):
- File "D:\ProgramData\Anaconda3\envs\python310\lib\threading.py", line 1009, in _bootstrap_inner
- self.run()
- File "D:\ProgramData\Anaconda3\envs\python310\lib\threading.py", line 946, in run
- self._target(*self._args, **self._kwargs)
- File "D:\ProgramData\Anaconda3\envs\python310\lib\site-packages\ultralytics\utils\plotting.py", line 442, in plot_images
- c = names.get(c, c) if names else c
- AttributeError: 'str' object has no attribute 'get'
-
- Process finished with exit code 1
-
複製代碼
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
官方文件鏈結 https://docs.ultralytics.com/models/
程式碼
- from ultralytics import YOLO
- import os
- os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
-
- if __name__ == '__main__':
- # Load a COCO-pretrained YOLOv8n model
- model = YOLO('yolov8n.pt')
-
- # Display model information (optional)
- model.info()
-
- # Train the model on the COCO8 example dataset for 100 epochs
- results = model.train(data='coco8.yaml', epochs=100, imgsz=640)
-
- # Run inference with the YOLOv8n model on the 'bus.jpg' image
- results = model('bus.jpg')
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()
- 代碼報錯
- OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
- OMP: Hint This means that multiple copies of the OpenMP runtime have been linked intograms link. cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, eg by avoiding static linking of the OpenMP runtime in any library。 variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/support/ducts
複製代碼
NetYea 網頁設計 發表在 痞客邦 留言(0) 人氣()