什麼是 純量、向量與張量運算單元

在現代計算領域中,根據處理數據類型的維度與運算方式的不同,運算單元主要分為處理純量 (Scalar)向量 (Vector)張量 (Tensor) 三大類。


數據結構與運算單元定義

1. 純量運算單元 (Scalar Processing Unit, SPU)

純量 (Scalar) 是指一個單一的數值,例如 $x = 5$Read more

放棄PhotoPrism 改用 immich

放棄PhotoPrism 改用 immich

PhotoPrism相簿系統中,有一些功能沒有,而immich有,而且PhotoPrism操作,不如immich直接。所以,我就把PhotoPrism移掉,改用immich
一樣,是使用Docker Compose

name: immich

services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
#   file: hwaccel.transcoding.yml
#   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
– ${UPLOAD_LOCATION}:/usr/src/app/upload
– /etc/localtime:/etc/localtime:ro
env_file:
– .env
ports:
– ‘2283:2283’
depends_on:
– redis
– database
restart: always
healthcheck:
disable: false

immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
# extends: # uncomment this section for hardware acceleration – see https://immich.app/docs/features/ml-hardware-acceleration
#   file: hwaccel.ml.yml
#   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference – use the `-wsl` version for WSL2 where applicable
volumes:
– model-cache:/cache
env_file:
– .env
restart: always
healthcheck:
disable: false

redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5
healthcheck:
test: redis-cli ping || exit 1
restart: always

database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: ‘–data-checksums’
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
– ${DB_DATA_LOCATION}:/var/lib/postgresql/data
healthcheck:
test: pg_isready –dbname=’${DB_DATABASE_NAME}’ –username=’${DB_USERNAME}’ || exit 1; Chksum=”$$(psql –dbname=’${DB_DATABASE_NAME}’ –username=’${DB_USERNAME}’ –tuples-only –no-align –command=’SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database’)”; echo “checksum failure count is $$Chksum”; [ “$$Chksum” = ‘0’ ] || exit 1
interval: 5m
start_interval: 30s
start_period: 5m
command:
[
‘postgres’,
‘-c’,
‘shared_preload_libraries=vectors.so’,
‘-c’,
‘search_path=”$$user”, public, vectors’,
‘-c’,
‘logging_collector=on’,
‘-c’,
‘max_wal_size=2GB’,
‘-c’,
‘shared_buffers=512MB’,
‘-c’,
‘wal_compression=on’,
]
restart: always

volumes:
model-cache:

—-
環境變數要加外建 .env
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC

# The Immich version to use. You can pin this to a specific version like “v1.71.0”
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

原來 批量管理 wordpress 比想像中的簡單

原來 批量管理 wordpress 比想像中的簡單

wordpress 更新的速度,真的快,畢竟全球麼多人在用,駭客也在盯這塊,光是我自己的wordpress,就被跑進來駭了好幾次。

wordpress 可以更新的東西很多,主體,插件,佈景和與言包等等。

之前都是土法煉鋼去更新一個wordpress,再用shell指令去更新 Read more

請給我 ffmpeg 參數 轉換寬度最高1920px h.265 編碼 使用字幕檔

請給我 ffmpeg 參數 轉換寬度最高1920px h.265 編碼 使用字幕檔

蒐集了不少4K的原檔,但是機上盒播不了,所以有轉檔的需求
ffmpeg -i input.mp4 -vf “scale=’min(1920,iw)’:-2” -c:v libx265 -crf 28 -c:a copy -c:s mov_text -vf subtitles=subtitles.srt output.mp4

可是怎麼也執行不起來,因為字幕,我是用有特效的.ass格式,輸入檔也不是mp4格式,而是MKV格式
Read more

[chatGPT 測試]寫一隻 Windows環境下的Python,調用ffmepg調整解析度為1080

寫一隻python 符合下面功能需求
1.本程式運行平台為Windows
2.調用ffmpeg.exe進行解析度調整
3.使用 ffmpeg 中的scale 參數,設定最大長寬為1080
6.指定路徑進行儲存
7.檔案已存在測略過
8.目標的格式為mp4
9.目標的fps為30
10.編碼方式為x265
11.ffmpeg.exe 已安裝於指定的路徑

Read more