Comments (4)
Hi @mooch443
Hope you are well. I appreciate that you are doing this off your own back, and the system is revolutionary for the work I am doing.
I just wondered if you had seen/can respond to the above question?
All the best,
Mark
from trex.
Hey, yes, you're right - this is basically on my free time right now, but I want to help whenever I can.
So if you're trying to see the speed in x-direction (the velocity), you can use VX from the npz file, which is exactly that. You can of course try to fix the posture data so far that you can use it. Not sure how well it performs on those - I suspect you would have to increase the track_posture_threshold
quite a bit for it to work. Pro-Tip: You can always check using track_threshold
to see if a certain threshold value works as intended (cuts off enough of the animals, like the legs and antennae) and then set this value for track_posture_threshold
- and reset track_threshold
to what you had before. I'll make this easier in 2.0, so stay tuned I guess!
The question would be whether VX is already enough (or you could calculate VX yourself by using the X-positions), or if you need posture to work reliably. I think VX should suffice in your case, though, unless you say otherwise.
If you want to calculate distance covered, you could do sum(SPEED * time') for a certain range of frames, no? You just have to modify it somehow so that you have one value per fix sequence length or something. If that's what you need :D
-Tristan
from trex.
Perfect, thank you so much!
If I wanted to see how far they move up or down from the midline I can use the Y.wcentroid?
And is there a way to have rolling IDs, so never repeat an ID when that ID is lost? So for example, we have ant 1 that moves from left to right in the box, he goes out of the video and a new ant appears, rather than assigning it with the same number (if the programme believes it's the same ant) it always rolls over to a new ID.
TIA
from trex.
Hey! There is no way to do this, no. However, there is a way in Python that I can share if you are interested. Instead of assigning the same number, you would get a dataframe with IDs per segment (so as you suggested).
(its not pretty code and might not work out of the box, but I think it helps to illustrate)
##### CONFIG
columns = [
("x", "X#wcentroid"),
("y", "Y#wcentroid"),
('num_pixels', 'num_pixels'),
('time', 'time'),
('angle', 'ANGLE#wcentroid'),
('vx', 'VX#wcentroid'),
('vy', 'VY#wcentroid'),
("speed", 'SPEED#wcentroid')
]
video = "video_name"
base_path = "/root/path"
##########
segID = 0
DF = None
output = output_dir+os.sep+video+".pkl"
files = glob.glob(base_path+os.sep+"data"+os.sep+video+"_fish*.npz")
if len(files) == 0:
raise Exception("No data for video",video)
print("\tFound",len(files),"files.")
j = 0
for path in sorted(files):
index = path.split(os.sep)
index = int(index[-1].split('_fish')[-1].split('.')[0])
j = j + 1
if j%100 == 0:
print(j,"/",len(files),path,"individual",index)
with np.load(path) as npz:
frame_segments = npz["frame_segments"]
frame = npz["frame"].astype(int)
m = {
"id": np.repeat(index, len(frame)),
"frame": frame
}
for c, k in columns:
m[c] = npz[k]
m[c][np.isinf(m[c])] = np.nan
#print(m[c].shape)
segIDs = np.full(len(frame), -1, dtype=int)
for start, end in frame_segments:
if end - start >= segment_threshold:
segIDs[np.logical_and(frame >= start, frame <= end)] = segID
segID += 1
m["segID"] = segIDs
df = pd.DataFrame(m)
if type(DF) == type(None):
DF = df
else:
DF = pd.concat((DF, df), ignore_index = True)
DF # your dataframe
from trex.
Related Issues (20)
- Override automatic matches HOT 3
- pvinfo not displaying information about blobs
- Visual identification fails HOT 3
- Auto_categorize not working HOT 2
- Regions of interest (ROIs) HOT 2
- Movement Initiations HOT 1
- Problem while installing TRex on MacOS HOT 1
- Trex freezes when opening video file (.mp4) HOT 8
- Endless "python not initialised" warning when entering training mode HOT 4
- [GLFW] Error 65540: 'Invalid window size 0x0' HOT 1
- Unable to convert video file with tgrabs HOT 3
- Errors during "Compile it yourself" installation at build_conda_package.bat HOT 3
- Allow TGrabs detections in a single direction (brighter or darker than background) HOT 2
- Windows installations fail HOT 20
- TRex fails to launch on MacOS after installation HOT 5
- Flipping body axis between head and taill while drosophila tracking HOT 1
- Beta: Dialogs for file and directory selection HOT 2
- Beta: Conda installation fails on Mac HOT 2
- Beta: Doesn't run on command `trex` HOT 2
- Issues Installing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trex.